Netbeans Java Programming Help Needed ASAP!

Status
Not open for further replies.

jgonzo

Honorable
Oct 5, 2012
11
0
10,560
Need help with the following problem ASAP.

Problem:
Use netbeans to write a java program that prints the following expressions. Output the result of calculations not the literal value, when displaying the answers. (For instance display 7*5, not 12). Decimals should be displayed as shown.
The sum of 7 and 5 is 12
The product of 6 and 3 is 18
The square of 5 is 25.0
52 divided by 3.0 is 17.333
 

randomizer

Distinguished
I'm scratching my head here. Am I the only person who sees the section in parentheses as a direct contradiction of the instruction preceding it (let alone the fact that 7*5 is not a sum)? It's amazing how the most trivial of academic exercises can be made complicated by people who can't word instructions clearly.

In any case, read this: http://www.tomshardware.com/forum/244553-49-read-programming-assignment-help
 

jgonzo

Honorable
Oct 5, 2012
11
0
10,560
Thank you! I was thinking the same thing about the instructions. To make it worse I can't get a response in what she really wants, super irritating but glad it wasn't just me seeing it that way. Thank you
 

jgonzo

Honorable
Oct 5, 2012
11
0
10,560
I was thinking to set it up as System.out.println("7+5");
Then continuing for the next and the next, but then again that is sooo stupid easy that it makes me doubt that is what she wants. Per her instructions it says not the literal value which would display just 12 is not wanted, so don't set it up as a solved expression, agreed?
 

jgonzo

Honorable
Oct 5, 2012
11
0
10,560
Found out how to do them in the proper format, now my issue is with the last two. I don't know how, or if, there is a proper way to do squares in that format? Also, how do you do placeholders? I know its System.out.printf as the opener, but I get confused on how you put the %.2f and where because I keep getting errors.
System.out.println("The sum of 7 + 5 is " + (7+5));
System.out.println("The product of 6 * 3 is " + (6*3));
System.out.println("The square of 5 is " + (5*5));
System.out.printf("52 / 3.0 is " + (52/3.0));
 
Status
Not open for further replies.