Java,。
Write a program that takes one positive integer as input and assume the integer is n. You program will print a figure according to the value of n. Some samples are displayed as below.
Problem-2 Print a butterfly
Implement the program that takes an integer n as input and prints out the following pattern.
n is an input integer, and you may assume n is less than 10 and n is nonnegative. Note the spacing and how the digits align between different lines.
Problem-3 Prime numbers
Implement the program that takes an integer n and output all the prime numbers in increasing order that satisfy the three requirements: 1) no more than n (includes n); 2) the last digit of the prime numbers cannot be 3; and 3) the sum the printed numbers cannot be larger than 3n. Check Wiki if you need the definition of prime numbers.
Submission Guidelines
What if I do not follow the suggested filenames (e.g., A.java)?
- You should put your programs into the Source Programs, and only Source program need to be submitted.
- Your assignment may be missed and may not be marked.
What is “Programming Skills”?
- Document your source programs properly (e.g., put appropriate comments at appropriate places in your source programs)
- Name the variables in the meaningful ways
- Use proper indentation
- Your programs are well designed and easily readable
How do you mark my assignment?
- For each problem, we have several test cases. Also, we will read your program.
- If your program does not show correct answers, some (or all) marks will be deducted depending on the mistakes/errors you make.
- If your program has “compilation errors”, NO MARK will be given.
- For each problem, we mark your “programming skills”. As long as your “programming skills” is acceptable, no mark will be deducted
What else I should know?
Each source program must start with the following comments: