Java Basics The sixth chapter after class exercises

Source: Internet
Author: User

1. Explains the difference between a break statement and a continue statement in a looping structure.

The break statement in the loop structure is the end of the program run.

Continue statement is the end of this sentence program is not the end of the program.

2. Use the For loop structure to accept the daily learning time from Monday to Friday from the keyboard and calculate the average daily learning time. Output results.

3. Chicken and rabbit cage problem. Now there are chickens and rabbits with cages, there are 35 head, under 94 feet, ask the chicken rabbit each? Try to write a program to solve the problem.

4. Develop a game application titled "Flipflop". It counts from 1 to 100, encounters a multiplier of 3 to output the word "Flip", encounters a multiple of 5 to output the word "Flop", encounters even if 3 is a multiple of 5 and then outputs the word "flipflop", and the remainder outputs the current number.

5. In the Marx manuscript there is such a fun math problem: a total of 30 people, may include men, women, children. They spent 50 shillings at a restaurant, 3 shillings per man, 2 shillings per woman, and 1 shillings per child. How many men, how many women, how many children? Programming is complete.

6. Read the program and write down the value of the variable sum after the program ends.

sum==26;

The first cycle I=1 the end of the sum==6; meet continue to end the cycle

The second cycle 1=2 cycle ends sum==10;

Third cycle i=3 cycle end sum==26;

Output sum==26;

Java Basics The sixth chapter after class exercises

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.