Free Help for beginner's programmers  

Go Back   Free Help for beginner's programmers > Public forum. > Java Programming Help

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 11-26-2016, 05:28 PM
Helper Helper is offline
Administrator
 
Join Date: Aug 2016
Posts: 3
Default Java Homework Need Help

Section2 : Exercise User Requirements (exercise.cpp): Your exercise.cpp program will build on the functionality of the exercisea.cpp program. It will ask the user how many books they wish to enter, then let the user enter that many books. The user can enter from 1 to 10 books. You should also add error-checking to the enterBook function to ensure the user enters valid data for each field. Once all the book information is entered, display the information back to the user. Assumptions: ? The $ symbol is not endtered by the user, it is part of the output ? prices must be > 0. Users should be given a warning if they attempt to enter an invalid value, and try again ? ISBN?s should be positive integers ? When outputting the price, format it with 2 values after the decimal, ? You may specify a max price Exception Handling: ? If the user enters a non-numerical value for the isbn, price, or number of books, output an error and let the user try again. The program should let the user try indefinitely until they enter valid input Sample Output: This program let?s the user enter information about a number of books, and output the information back to the user. Please enter a number between 1 and 10: boo sorry, try again Please enter a number between 1 and 10: 2 1: Please enter the book's info: ISBN: 123412341 title: A Book author (lastName, firstName): Smith, Bob price: $5 2: Please enter the book's info: ISBN: 1234567890 title: Another Book author (lastName, firstName): Jane, Mary price: $5.5 These are the books you entered: ISBN: 123412341 Author: Smith, Bob Title: A Book price: $5.00 ISBN: 1234567890 Author: Jane, Mary Title: Another Book price: $5.50 This program let's the user enter information about a number of books, and output the information back to the user. Please enter a number between 1 and 10: 3 1: Please enter the book's info: ISBN: boo Sorry, that was not a number, please try again 12341234 title: book author (lastName, firstName): baggins, bilbo price: $-9 Sorry, that was not a number, please try again 8 2: Please enter the book's info: ISBN: 1234567890 title: geldof, bob author (lastName, firstName): geldof, bob price: $4.56 3: Please enter the book's info: ISBN: 09870987 title: Cat in the Hat author (lastName, firstName): Seuss, Dr. price: $99.90
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:55 PM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.