Computers and Technology, 21.07.2021 14:00 michelle7511
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;
}
}
Answers: 1
Computers and Technology, 22.06.2019 19:10, sammigrace5820
How might the success of your campaign be affected if you haven’t carefully completed all field data or if you accidentally insert the wrong merge field in the document?
Answers: 1
Computers and Technology, 22.06.2019 21:30, Nathaliasmiles
The graph shows median weekly earnings for full-time workers according to education level. which can you not conclude?
Answers: 2
Computers and Technology, 22.06.2019 22:30, studybug2306
Jason needs to learn a new web tool. he went through his books to understand more about it. now he wants hands-on experience with using that tool. what would him? jason can use websites where workspace is provided to test the results of your code.
Answers: 2
Hi ! How can you return the value of the class computeDiscountInfo to the variable savings in the ma...
History, 22.10.2020 22:01
History, 22.10.2020 22:01
Biology, 22.10.2020 22:01
Mathematics, 22.10.2020 22:01
Mathematics, 22.10.2020 22:01