7 instructions I have to do in java
420-101-VA Teacher: Jaina Sheth Programming 1 Assignment - 03 Vanier College April 7, 2021 Deadline : 23rd April, 2021 Time : 11:59 PM Marks: 60 Points Read the instructions carefully. 1 General Instructions • This work is an individual work and should satisfy expectation of originality. • Any form of plagiarism will not be tolerated. • You must submit a single .zip file for this assignment on Lea under 420-101-VA Assignment-03. • Place all your Java programs (.java files) directly in a folder with a name Lastname Firstname StudentID (e.g.,Sheth Jaina 2115533). Compress (zip) the folder and submit a .zip file only. There shouldn’t be any package folder or src folder inside the zipped folder. • You must not submit files with extensions such as a .rar, .tz, .7z, .java, .txt, etc. • If you submit a file other than .zip file, your submission will not be considered and you will be graded a straight 0. Also, if you submit multiple files, only the last submitted work will be considered. 2 Grading You will be graded out of 60 points according to the following distribution: • [15 points] 5 points for each of the tasks 1, 2 and 3. • [30 points] 10 points for each of the tasks 4, 5 and 6. • [15 points] 15 points for the task 7. 3 Tasks Write a Java program for each of the following. Design a generalized solution which can work for any valid values of variables. 1. Accept three whole numbers as user input. Find the biggest number out of the entered numbers and return the result on the screen. 2. Accept a whole number as the user input. Check the divisibility of that number by 3, 5 and 15 and display the result on the screen. • For example, if we consider the number 45, then the program should display “num- ber is divisible by 3, 5 and 15”. If we consider the number 17, then the program should display “number is not divisible by 3 or 5 or 15”. If we consider the number 21, then the program should display “number is divisible by 3 but not by 5 or 15”. If we consider the number 20, then the program should display “number is divisible by 5 but not by 3 or 15”. • These are just some examples. Your program should work for any valid whole number entered by the user, not just the given numbers. 3. Accept a whole number as user input. Check whether the entered number is odd & positive, even & positive, odd & negative, even & negative or 0. Display the result on the screen. 4. Accept a whole positive number as the user input. Check whether entered number is a prime number and display the result on the screen. • A prime number is a number which is divisible only by number 1 and itself. • For example, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31,... are prime numbers. • So, if the entered number is divisible by any number other than 1 and itself, then it is not a prime number. • For example, 4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25,.... are non-prime numbers. 5. Display the following pattern using nested loops: ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ Page 2 6. Make a simple calculator using switch case. Accept two numbers from the user. Then, ask the user to enter his choice when given the following options: 1. Addition 2. Subtraction 3. Multiplication 4. Quotient of the Division 5. Remainder of the Division According to the user entered choice, perform the mathematical operation on user entered numbers and display appropriate answer. 7. Accept 10 positive whole numbers from the user one by one. If user enters any negative number, then ask him again to enter a positive number instead. Calculate total and average of these 10 positive numbers entered by the user. (Even if the user enters some negative numbers, at the end you should have exactly 10 different positive whole numbers to calculate the total and the average.) Page 3 General Instructions Grading Tasks