Classroom Practice Harry Potter

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.