Question: java Q1: Write a program that takes n integer numbers from the user, and then counts the number of even numbers and odd numbers and

Q1: Write a program that takes n integer numbers from the user, and then counts the number of even numbers and odd numbers and print them to the screen. Sample Output: Enter how many numbers you have: 10 Enter the 10 numbers: 1 3 19 50 4 10 75 20 68 100 The number of even numbers is: 6 The number of odd numbers is: 4 Q2: Write a program that takes two double arrays a and b of size n from the user. Then, use a method product to find the product of a and b and store the result in an array. Then, return the resultant array and store it in an array c, then prints the returned results to the screen. (Note: c[i] = a[i] *b[i], for i = 0, ..., n-1) Sample Output: Enter the size of your arrays: 5 Enter the values of the first array a: 1.2 3.0 2.0 5.50 Enter the values of the second array b: 6.5 4.2 8.4 3.3 10.6 The result array c = a*b: 7.8 12.6 16.8 18.15 0.0 Q3: Write a program that calculates the area and circumference of a circle. It should ask the user first to enter the number of circles n, then reads the radius of each circle and stores it in an array. The program then finds the area and the circumference, as in the following equations, and prints them in a tabular format as shown in the sample output. Area = Tr, Circumference = 2nr, 1 = 3.14159 Sample Output: Enter the number of circles: 4 Enter the radius of circle 1: 10.5 Enter the radius of circle 2:5 Enter the radius of circle 3:30.7 Enter the radius of circle 4 : 12.5 Circle Radius Area Circumference 10.5 346.36 65.97 1 of 2 5 30.7 12.5 78.54 2960.92 490.87 31.42 192.89 78.54 Q4P: Design a class named Student that contains the following private instance variables A string data field name for the student name. An integer data field id for the student id. A double data field GPA for the student GPA. An integer data field registered Credits It contains the following methods. An empty default constructor. A constructor that creates a student record with a specified id and name. The get and set methods for id, name, GPA, and registeredCredits A method called registerCredit that adds specified amount of credits to the student A method called withdrawCredit that withdraws specified amount of credits from the student. a. Implement the class. b. Write a test program that creates a student account using your name and id. Set all the variables information to your student information (GPA, and registered credits). Use the register Credit method to add 9 more credits. Use the method withdrawCredit to withdraw 3 credits. Then prints out all the student information: name, id, GPA, and registerdCredits. Sample Output: Enter your GPA: 3.9 Enter your registered credits: 30 Student name: Sara Student ID: 12345678 GPA: 3.9 Registered credits: 36
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
