0

java create a book ordering system challenge

You are being asked to create a book ordering system. Your book ordering system must include following function: 1. User must be able to enter book title (Set the limit of 100 for books. User press enter again for end of book) 2. User must be able to enter book price 3. User must be able to display all book 4. User must be able to place order (Set the limit of 50 for order) 5. User must be able to choose the quantity of the selected book 6. User must be able to select another book for purchase 7. System must be able to display order summary of user selected book and quantity 8. System must be able to calculate the total price of book ordered 9. System must be able to calculate the money return after payment 10. System must be able to generate receipt after complete payment 11. You also need to include any error checking method for invalid input

22nd Apr 2018, 9:33 AM
Leon L
Leon L - avatar
2 Answers
0
//I finished half import java.util.Scanner; public class FNPT { public static void main(String[]args) { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String No,again; int quantity,price1=0,price2=0,loop1=0,quantity1,quantity2=0; Scanner input = new Scanner(System.in); String[] BookName = new String[50]; int[] price = new int[50]; for(int x = 0; x < BookName.length; x++) { System.out.print("Please Enter Title(Press again for end of book) of Book " + (x+1) +":" ); BookName[x] = input.nextLine(); if(BookName[x].equals("")) { System.out.println(); break; } } for(int y = 0 ; y < BookName.length; y++) { System.out.print("Please Enter price for book " + BookName[y] + ":RM"); price[y] = input.nextInt(); if(BookName[y].equals("")) { System.out.println(); break; } } System.out.println("No\t\t\t\tBookName\t\t\t\tPrice"); for(int z = 0 ; z < 100 ; z++) { if(BookName[z].equals("")) break; else { System.out.println((z+1) + "\t\t\t\t" + BookName[z] + "\t\t\t\t\t" + "RM" + price[z]); } } } }
22nd Apr 2018, 9:36 AM
Leon L
Leon L - avatar
0
Nice code, how about another half?
27th Aug 2020, 9:09 AM
Jason wong
Jason wong - avatar