Question 1 Write pseudocode for a program Goal calculates th
Question 1: Write pseudocode for a program.
Goal: calculates the total of retail sale.
The program will ask the user:
- The retail price of the product being bought
- sales tax rate
Program will Calculate and display the following:
The amount of the sales tax for the purchase
The total amount of the sale
Solution
RetailTest.java
import java.util.Scanner;
public class RetailTest {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
double retailCost = 0;
int percetange = 0;
do{
System.out.print(\"Enter an item\'s retail price: \");
retailCost = scan.nextInt();
}while(retailCost <= 0);
do{
System.out.print(\"Enter sales tax percentage: \");
percetange = scan.nextInt();
}while(percetange <= 0);
double retailPrice = caclulateRetail(retailCost, percetange);
System.out.println(\"Retail price is \"+retailPrice);
}
public static double caclulateRetail(double retailCost, int percentage ){
double retailPrice = 0;
retailPrice = retailCost + retailCost* percentage/100;
return retailPrice;
}
}
Output:
Enter an item\'s retail price: 100
Enter sales tax percentage: 10
Retail price is 110.0
