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 18:30
Which of these options are the correct sequence of actions for content to be copied and pasted? select content, click the copy button, click the paste button, and move the insertion point to where the content needs to be inserted. click the copy button, select the content, move the insertion point to where the content needs to be inserted, and click the paste button. select the content, click the copy button, move the insertion point to where the content needs to be inserted, and click the paste button. select the content, move the insertion point to where the content needs to be inserted, click the copy button, and click the paste button.
Answers: 3
question
Computers and Technology, 23.06.2019 18:30
Write a program that prints the day number of the year, given the date in the form month-day-year. for example, if the input is 1-1-2006, the day number is 1; if the input is 12-25-2006, the day number is 359. the program should check for a leap year. a year is a leap year if it is divisible by 4, but not divisible by 100. for example, 1992 and 2008 are divisible by 4, but not by 100. a year that is divisible by 100 is a leap year if it is also divisible by 400. for example, 1600 and 2000 are divisible by 400. however, 1800 is not a leap year because 1800 is not divisible by 400.
Answers: 3
question
Computers and Technology, 24.06.2019 15:00
Universal windows platform is designed for which windows 10 version?
Answers: 1
question
Computers and Technology, 24.06.2019 15:30
What is the function of compilers and interpreters? how does a compiler differ from an interpreter?
Answers: 2
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, 29.06.2021 05:00
question
English, 29.06.2021 05:10
question
Mathematics, 29.06.2021 05:10
question
Mathematics, 29.06.2021 05:10