Fill in the blanks below to create a method that takes as parameters an original
ID: 3629812 • Letter: F
Question
Fill in the blanks below to create a method that takes as parameters an original price and a percent discount (represented as real numbers) and computes and returns the discounted price (also as a real number). For example, if the original price is 50.0 and the percent discount is 10.0, your method should return a discounted price of 50.0 - 0.10(50.0) = 45.0. (You will need to divide the percentage by 100 as part of the computation.) Use the names originalPrice and percentDiscount for the parameters.public static ______ discountedPrice(______________________) {
double newPrice = ___________________;
__________________;
}
Explanation / Answer
public static double discountedPrice(double price,double discount) {
double newPrice = price- price*(discount/100);
return newPrice;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.