Hey, Guys and gals..
I am facing a problem with a problem. My problem is I do not know how to start this problem. The problem is:
A mail-order house sells five products whose retail prices are as follows: Product 1, $2.98; product 2, $4.50; product 3, %9.98; product 4, $4.49 and product 5, $6.87. Write an application that reads a seris of pairs of numbers as follows:
a) product number b)quantity sold
The program should use a switch statement to determine the retail price for each product. It should calculate and display the total retail value of all products sold. Use a sentinel-controlled loop to determine when the program should stop looping and display the final results.
The program should have two methods. Not counting the main.
I have made a switch Statement. I know need to get a result. How do i do that. Here is the Switch Code:
import java.util.Scanner; // program uses Scanner
public class tw54663A8def
{
private int total;
private int aCount;
private int bCount;
private int cCount;
private int dCount;
public static void prodCounters( int prodN, int prodQ)
{
switch ( prodN )
{
case 1: ++ prodQ; // increment aCount
break; // neccessary to exit switch statement
case 2: ++ prodQ; // increment bCount
break; // necessary to exit switch statement
case 3: ++ prodQ; // increment cCount
break; // necessary to exit switch statement
case 4: ++ prodQ; // increment dCount
break; // necessary to exit switch statement
default: ++ prodQ; // increment default
break; // necessary to exit switch statement
}
}
Thanks,
Thomas