1. Design ideas:
The teacher summed up the rules after summing up in class. The number of books first to 5, if the remainder is three, but also to consider whether as long as three. With only three copies, the price can be calculated directly. If it is more than three, you have to follow the 8 original calculation. The remainder is not three and can be calculated by law.
Packagearraysum;ImportJava.util.*; Public classBuybook { Public Static voidMain (string[] args) {intBooknum = 0; DoubleMoney = 0; Scanner SC=NewScanner (system.in); System.out.println ("Please enter the number of books you want to buy:"); Try{booknum=Sc.nextint (); } Catch(inputmismatchexception e) {System.out.println ("Your input is wrong"); } if(Booknum = = 3) { money= 21.6; } Else if(booknum% 5 = = 3) { money= Booknum*8-((bookNum-8)%5) *10-12.8; } Else if(booknum% 5 = = 1) { money= (BOOKNUM/5) *30 + 8; } Else if(booknum% 5 = = 2) { money= (BOOKNUM/5) *30 + 15.2; } Else if(booknum% 5 = = 4) { money= (BOOKNUM/5) *30 + 25.6; } Else if(booknum% 5 = = 0) { money= (BOOKNUM/5) *30; } System.out.println ("The cheapest book price is:" +Money ); }}
3.
It is important to learn the ability to summarize. The ability to collaborate in a team is also fostered. If you can't think of it, write more on the paper. Be good at summing up the special point of the special place.
Classroom Practice Harry Potter