This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

can you bleas help me i cant figure how to put the sixth choice in the solution  RSS feed

 
yara hussien
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The book store at BZU sells five types of notebooks whose retail prices are as follows: notebook 1, $2.98; notebook 2, $4.50; notebook 3, $9.98; notebook 4, $4.49; notebook 5, $6.87 and it offers a package of all the products at $20.00 (option 6), that is, 4 $ will be added to the total of each notebook (i.e., if you bought 2 packages then 8 $ will be added to each notebook).
Your application should read the notebook number and the quantity sold.
Notes:
• Use a switch statement to determine the retail price for each notebook.
• Calculate and display the total amount ($) of all products sold.
• Let the user enter 0 to exit the loop and show the results.
Below is a sample output for the application …

Enter notebook number (1-6) (0 to stop): 5
Enter quantity sold: 3
Enter notebook number (1-6) (0 to stop): 2
Enter quantity sold: 4
Enter notebook number (1-6) (0 to stop): 6
Enter quantity sold: 2
Enter notebook number (1-6) (0 to stop): 0
notebook 1: $8.00
notebook 2: $26.00
notebook 3: $8.00
notebook 4: $8.00
notebook 5: $28.61
 
Les Morgan
Rancher
Posts: 768
19
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, I see  you posted the assignment, but what have you done so far and what is  your question?

yara hussien wrote:The book store at BZU sells five types of notebooks whose retail prices are as follows: notebook 1, $2.98; notebook 2, $4.50; notebook 3, $9.98; notebook 4, $4.49; notebook 5, $6.87 and it offers a package of all the products at $20.00 (option 6), that is, 4 $ will be added to the total of each notebook (i.e., if you bought 2 packages then 8 $ will be added to each notebook).
Your application should read the notebook number and the quantity sold.
Notes:
• Use a switch statement to determine the retail price for each notebook.
• Calculate and display the total amount ($) of all products sold.
• Let the user enter 0 to exit the loop and show the results.
Below is a sample output for the application …

Enter notebook number (1-6) (0 to stop): 5
Enter quantity sold: 3
Enter notebook number (1-6) (0 to stop): 2
Enter quantity sold: 4
Enter notebook number (1-6) (0 to stop): 6
Enter quantity sold: 2
Enter notebook number (1-6) (0 to stop): 0
notebook 1: $8.00
notebook 2: $26.00
notebook 3: $8.00
notebook 4: $8.00
notebook 5: $28.61
 
Campbell Ritchie
Marshal
Posts: 55698
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Les Morgan wrote:OK, I see  you posted the assignment, . . .
The assignment actually tells you what to do.
 
yara hussien
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is my code i just couldn't figure it out


 
Knute Snortum
Sheriff
Posts: 4073
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What problems are you having, specifically?

About your post: you almost got the code tags correct.  You need to surround the code with the start and end tags.  I fixed it for you this time.
 
yara hussien
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, i cant pass all the prices to my method and i think that its missing something which has a ling to the package choice but i just cant figure it out
 
Knute Snortum
Sheriff
Posts: 4073
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need a data structure (a variable type) that can hold a bunch of extensions (price * quantity) by notebook number.  Can you think of should a type in Java?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!