Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java Q2: Write a program that takes two double arrays a and b of size n from the user. Then, use a method product to

java image text in transcribed
image text in transcribed
image text in transcribed
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) 03: 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 = mir, Circumference = 2tr, n = 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 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 registeredCredits. 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 registerCredit 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential Data Protection For Estate Agencies In Singapore 2024

Authors: Yang Yen Thaw Yt

1st Edition

B0CQK79WD3, 979-8872095392

More Books

Students also viewed these Databases questions