In this assignment, you will create a Java program to create an array of students to...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
In this assignment, you will create a Java program to create an array of students to search. The program must implement a student class as specified in the following UML diagram. Student -name: String -id: int -gpa: float <constructor>> +Student(String, int, float) +pringStudent(): void +getID(0:int 1. The program will first ask the user to input the number of students to be created. The number should be from 1 to 10. Otherwise, the program prints "I cannot create xx students!" where xx is the input number. 2. The program then prompts the user to input details of cach student including name, id, and gpa. 3. You must create an array of Student in the main method. The size of the array is decided by the number of students the user gives. Each element of the array will refer to a Student object. 4. The main method will prompt user for each student. It then uses Student's constructor to create a Student object and assign it to an array element. 5. The Student class should have a constructor that takes a name, an id, and a gpa, to create a Student object. 6. The Student class should have a method printStudent() that prints the student's name, id, and gpa, one per line. 7. After the creation of the Student objects, the program will then search the student array. It keeps asking the user for a student ID. If the student ID is 0, the program will print "Goodbye!" and exit. Otherwise, the program will search the student array for the given student ID. If a match is found, the program will call printStudent() to print the student information. If no match is found, the program prints "Student ID xxxx not found." 8. Since the student array may not be sorted, you should use linear search. 9. A sample run will look like this where the green texts are user inputs: How many students do you have (1-10): 4 Student 1 name: Anna Stomp Student 1 ID:1002 Student 1 GPA:2.3 Student 2 name: Elsa Ice Student 2 ID:1004 Student 2 GPA:3.2 In this assignment, you will create a Java program to create an array of students to search. The program must implement a student class as specified in the following UML diagram. Student -name: String -id: int -gpa: float <constructor>> +Student(String, int, float) +pringStudent(): void +getID(0:int 1. The program will first ask the user to input the number of students to be created. The number should be from 1 to 10. Otherwise, the program prints "I cannot create xx students!" where xx is the input number. 2. The program then prompts the user to input details of cach student including name, id, and gpa. 3. You must create an array of Student in the main method. The size of the array is decided by the number of students the user gives. Each element of the array will refer to a Student object. 4. The main method will prompt user for each student. It then uses Student's constructor to create a Student object and assign it to an array element. 5. The Student class should have a constructor that takes a name, an id, and a gpa, to create a Student object. 6. The Student class should have a method printStudent() that prints the student's name, id, and gpa, one per line. 7. After the creation of the Student objects, the program will then search the student array. It keeps asking the user for a student ID. If the student ID is 0, the program will print "Goodbye!" and exit. Otherwise, the program will search the student array for the given student ID. If a match is found, the program will call printStudent() to print the student information. If no match is found, the program prints "Student ID xxxx not found." 8. Since the student array may not be sorted, you should use linear search. 9. A sample run will look like this where the green texts are user inputs: How many students do you have (1-10): 4 Student 1 name: Anna Stomp Student 1 ID:1002 Student 1 GPA:2.3 Student 2 name: Elsa Ice Student 2 ID:1004 Student 2 GPA:3.2
Expert Answer:
Answer rating: 100% (QA)
Student class package myPackage public class Student private String name private int id pr... View the full answer
Related Book For
Microsoft Visual C# An Introduction to Object-Oriented Programming
ISBN: 978-1337102100
7th edition
Authors: Joyce Farrell
Posted Date:
Students also viewed these programming questions
-
Write a one to two-page commentary (using current APA format) on how selected technological innovations have impacted society in a positive way. PROJECT OVERVIEW In this assignment, you will visually...
-
Create a risk management plan. You have a budget of $100,000 and a timeline of six (6) months for the plan. Refer to Figure A-1, Risk Management Plan Template, from Appendix A of the Hillson and...
-
2017 Subaru Legacy Sedan 4 cyl 4 Door Sedan with 136,300 miles. The customer complaint is that when they put their Right Directional on it has a steady clicking/blinking sound coming from their...
-
Selected answer is incorrect During substantive procedures, performing analytical procedures satisfies which primary audit objective: Cutoff Accuracy Existence Completeness 2 answers
-
What do you think are the similarities between what this company did and how motor vehicle manufacturers design their products?
-
Carr Auto Wholesalers had sales of $900,000 in 2015, and cost of goods sold represented 65 percent of sales. Selling and administrative expenses were 9 percent of sales. Amortization expense was...
-
Copy your worksheet from Question 6 into another worksheet. Change the increase from 10% to 18%. Protect the worksheet, so that changes cannot be made. Question 6 Open a new spreadsheet. Type...
-
Here are comparative balance sheets for Taguchi Company. Additional information:1. Net income for 2010 was $103,000.2. Cash dividends of $45,000 were declared and paid.3. Bonds payable amounting to...
-
The amount of bacteria in a culture was continuously increasing at a rate of 15%. The original bacteria count was 1000, and time, t, is measured in hours. 13. Write a model for the bacteria count in...
-
A firm sells a product in a market where there are two types of consumers, high and low-valuation consumers. There are equally many of the two types of consumers, and the total number of consumers is...
-
Jackson and Ashley Turner (both 45 years old) are married and want to contribute to a Roth IRA for Ashley. In 2019, their AGI is $197,000. Jackson and Ashley each earned half the income. How much can...
-
Could you delineate both the beneficial and detrimental impacts of modernization on society, encompassing its multifaceted effects on various aspects of human life and societal structures?
-
Ashley takes out a loan today and repays the loan with eight level annual payments, with the first payment one year from today. The payments are calculated based on an annual effective interest rate...
-
Explain how an organisation can transition data into knowledge and give an example
-
1. There are 169 students who are in need of emergency treatment. Each of these students requires a transfusion of one unit of whole blood. The clinic has supplies of 170 units of whole blood. The...
-
Parallel processing involves: one processing core working on two subtasks of a problem at the same time two or more processor cores taking turns to complete a subtask, each working while the other...
-
Himalaya Herbal ( Pvt . ) Ltd . is a private company incorporated to farm the medicinal herbs and collect the wild herbs from local farmers in Magdi District. It started plantation of medicinal herbs...
-
Determine the center and radius of each circle. Sketch each circle. 4x 2 + 4y 2 9 = 16y
-
For a program to create a file object, it must include the _____________________ file. a. fileStream b. fstream c. outFile d. sequential
-
In this exercise, you modify the program from Computer Exercise 23. If necessary, create a new project named Intermediate24 Project and save it in the Cpp8\Chap12 folder. Copy the instructions from...
-
Write a C++ for clause that processes the loop instructions 10 times. Use numTimes as the counter variables name.
-
The expected effect on market efficiency of opening a securities market to trading by foreigners would be to: A. Decrease market efficiency. B. Leave market efficiency unchanged. C. Increase market...
-
Suppose that a speculative-grade bond issuer announces, just before bond markets open, that it will default on an upcoming interest payment. In the announcement, the issuer confirms various reports...
-
1. An analyst estimates that a securitys intrinsic value is lower than its market value. The security appears to be: A. Undervalued. B. Fairly valued. C. Overvalued. 2. A market in which assets...
Study smarter with the SolutionInn App