Thomas Wren

Greenhorn
+ Follow
since Nov 06, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Thomas Wren

Just a quick question.

If i have the intialize an array for example.


final int a[] = new int[Whatever]

what does the variable a symbolize?
17 years ago
From the few months I have been programming. I have used the class structure to program. So thats basically all I know. Which works out Really well. Go for the class.
17 years ago
Say I have a line that is going to be printed to the user. The line prompts the user to give him the choice rather to run the program or not.

The code would look like this;

System.out.println(" If you want to run the program again press 1. If not, then press 0.");

how can i make this Show up in color for a linux system? or in a pop up box.?
17 years ago
Close this one too.. Cause its just bogging down your space.
17 years ago
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
17 years ago
import java.util.Scanner; // program uses class Scanner

public class tw54663def
{
private int total; // sum of products
private int Counter; // quantity entered by user
private int aCount; // count of product 1
private int bCount; // count of product 2
private int cCount; // count of product 3
private int dCount; // count of product 4





This is How I think I am suppose to start it... How do i set values to the Products. So it still follows the format of the program.
17 years ago
The only problem with using Arrays, Is I havent learned them yet in class.
17 years ago
Thanks guys.. Have another question?

What if I did something like this;

public static void prodCounters(int N, int prodQ)
{
switch( prod N);
case 1; += prodQ; // increment aCount
break; // necessary to exit switch
case 2; +


how could I finish the rest?
17 years ago
How do I start this program?
17 years ago
it should be Product 3 $9.98
17 years ago
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.


Thanks,
Thomas
17 years ago