subject

Hi ! How can you return the value of the class computeDiscountInfo to the variable savings in the main class ? Here is my code :

import java. util. Scanner;
public class RoomCost{
public static void main (String [] args){
double price;
double discount;
double savings;

Scanner keyboard = new Scanner(System. in);
System. out. print("Enter cutoff price for discount $>> ");
price = keyboard. nextDouble();
System. out. print("Enter discount rate as a whole number >> ");
discount = keyboard. nextDouble();
displayinfo();
//insert code to set the value returned from computeDiscountInfo method to savings);
// savings =
System. out. println("Special this week on any room over " + price);

System. out. println("Discount of " + discount + " percent");

System. out. println("That's a savings of at least $" + savings);
}
public static void displayinfo(){
System. out. println("We want your stay to be memorable.");

System. out. println("We promise to make you as comfortable as possible.");

}
public static double computeDiscountInfo(double price, double discountRate)

{

double savings;

//(insert code to calculate savings as price multiplied by discount divided by 100);
savings = (price * discountRate)/100;
return savings;
}

}


Hi ! How can you return the value of the class computeDiscountInfo to the variable savings in the m

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:20
Consider a byte-addressable computer with 16mb of main memory, a cache capable of storing a total of 64kb of data and block size of 32 bytes. (a) how many bits in the memory address? (b) how many blocks are in the cache? (c) specify the format of the memory address, including names and sizes, when the cache is: 1. direct-mapped 2. 4-way set associative 3. fully associative
Answers: 2
question
Computers and Technology, 22.06.2019 21:30
After you clean an engine with hot water spray, it seems to stall; when it doesn't stall, it's idling noisily. technician a says to check for loose bolts on the flex plate near the torque converter. technician b says to wipe down the spark plug wires and the distributor cap. who is correct? a. technician a b. both technicians a and b c. technician b
Answers: 1
question
Computers and Technology, 24.06.2019 00:00
The gene form of a trait is called a(n) 
Answers: 2
question
Computers and Technology, 24.06.2019 10:10
Which view in a presentation program displays a split window showing the slide in the upper half and a blank space in the lower half?
Answers: 1
You know the right answer?
Hi ! How can you return the value of the class computeDiscountInfo to the variable savings in the ma...
Questions
question
Mathematics, 27.11.2019 15:31
Questions on the website: 13722363