# Total NOOB Needs Help Fast

T Hackett

Greenhorn

Posts: 2

posted 12 years ago

I am to do an assignment for my Java class(as in school not an actual class named Java)

I need to know how to perform the following calculation

User enters a number of coffee bags

coffee bags are shipped in a specific size box based on how many bags are ordered.

Program needs to get number of bags and calculate total number of boxes needed and the total cost.

Large box holds 20 bags and the box costs 2.00

Med box holds 10 bags and costs 1.00

small box holds 5 bags and costs .50

bags cost 5.50 each

I have the jist of what to do but I can't see how to do it without a java version of V/B's "If then Else" statement.

the text hasn't covered that yet.

please help if you can, my assignment is due tomorrow. today is tuesday the jan 18, 05

I need to know how to perform the following calculation

User enters a number of coffee bags

coffee bags are shipped in a specific size box based on how many bags are ordered.

Program needs to get number of bags and calculate total number of boxes needed and the total cost.

Large box holds 20 bags and the box costs 2.00

Med box holds 10 bags and costs 1.00

small box holds 5 bags and costs .50

bags cost 5.50 each

I have the jist of what to do but I can't see how to do it without a java version of V/B's "If then Else" statement.

the text hasn't covered that yet.

please help if you can, my assignment is due tomorrow. today is tuesday the jan 18, 05

posted 12 years ago

Java, as almost all programming languages, does have if and if/else statements avaiable. I'm fairly sure they would be covered in your text (at some point). You can also thake a look at the Sun's online tutorial on Control Flow Statements.

At a quick glance, using if statements is the way I would go about solving that problem. However I am curious as to why it would be presented to you prior to learning about if statements. What topics have you covered so far?

At a quick glance, using if statements is the way I would go about solving that problem. However I am curious as to why it would be presented to you prior to learning about if statements. What topics have you covered so far?

Michael Dunn

Ranch Hand

Posts: 4632