The xxx_Student class:– Name - the name consists of the First and Last name separated by a space.– Student Id – a whole number automatically assigned in the student class– Student id numbers start at 100. The numbers are assigned using a static variable in the Student class• Include all instance variables• Getters and setters for instance variables• A static variable used to assign the student id starting at 100• A toString method which returns a String containing the student name and id in the format below:Student: John Jones ID: 101 The xxx_Course classA Course has the following information (modify your Course class):– A name– An Array of Students which contains an entry for each Student enrolled in the course (allow for up to 10 students)– An integer variable which indicates the number of students currently enrolled in the course. Write the constructor below which does the following:Course (String name)Sets courseName to nameCreates the students array of size 10Sets number of Students to 0 Write the 3 getters+getCourseName() : String+getStudents() : Student []+getNumberOfStudents() : int Write the 2 setterspublic void addStudent (Student student)public void addStudent (String studentName) Write toStringReturn a String that contains the following information concatenated so that the information prints on separate lines as shown in the sample output:Course: xxxxx Number of Students: xxThe students in the class are:Each of the Student objects in the students array followed by a \n so they print on separate lines Write a class xxx_TestCourse which willPrompt the user for the name of a Course and create a Course objectIn a loop, until the user enters a q or a Q,Prompt the user to enter student names or Q to endFor each student entered,create a Student object and add it to the Course using the addStudent method of the Course classAt the end of the loop, print the Course object. Its toString method will format the output as shown on the next slide   Sample OutputEnter the course nameCPS2231-04Enter the name of a student or Q to quitJonEnter the name of a student or Q to quitMaryEnter the name of a student or Q to quitTomEnter the name of a student or Q to quitqCourse: CPS2231-04 Number of Students: 3The students in the class are:Student: Jon ID: 100Student: Mary ID: 101Student: Tom ID: 102

Question

The xxx_Student class:
– Name - the name consists of the First and Last name separated by a space.
– Student Id – a whole number automatically assigned in the student class
– Student id numbers start at 100. The numbers are assigned using a static variable in the Student class
• Include all instance variables
• Getters and setters for instance variables
• A static variable used to assign the student id starting at 100
• A toString method which returns a String containing the student name and id in the format below:
Student: John Jones ID: 101

The xxx_Course class
A Course has the following information (modify your Course class):
– A name
– An Array of Students which contains an entry for each Student enrolled in the course (allow for up to 10 students)
– An integer variable which indicates the number of students currently enrolled in the course.

Write the constructor below which does the following:
Course (String name)
Sets courseName to name
Creates the students array of size 10
Sets number of Students to 0

Write the 3 getters
+getCourseName() : String
+getStudents() : Student []
+getNumberOfStudents() : int

Write the 2 setters
public void addStudent (Student student)
public void addStudent (String studentName)

Write toString
Return a String that contains the following information concatenated so that the information prints on separate lines as shown in the sample output:
Course: xxxxx Number of Students: xx
The students in the class are:
Each of the Student objects in the students array followed by a \n so they print on separate lines

Write a class xxx_TestCourse which will
Prompt the user for the name of a Course and create a Course object
In a loop, until the user enters a q or a Q,
Prompt the user to enter student names or Q to end
For each student entered,
create a Student object and add it to the Course using the addStudent method of the Course class
At the end of the loop, print the Course object. Its toString method will format the output as shown on the next slide

 

Sample Output
Enter the course name
CPS2231-04
Enter the name of a student or Q to quit
Jon
Enter the name of a student or Q to quit
Mary
Enter the name of a student or Q to quit
Tom
Enter the name of a student or Q to quit
q
Course: CPS2231-04 Number of Students: 3
The students in the class are:
Student: Jon ID: 100
Student: Mary ID: 101
Student: Tom ID: 102

Expert Answer

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Tagged in
Engineering
Computer Engineering

Programing

Related Computer Engineering Q&A

Find answers to questions asked by students like you.

Q: Are all nonfunctional requirements equally important?  Why or why not?

A: Justification:“Yes”, All non functional requirements are equally important.

Q: I need help with this problem I attatched the sample output Exempt You will be writing a program to ...

A: Program plan:Display the welcome statementGet the average value from the user and check the average ...

Q: 1. What is the output of the following code? public class Loopy {public static void main(String[] ar...

A: 1.Explanation for the given java code:In the class "Loopy", variable "x" is declared and initialized...

Q: Consider a 4-way set associative cache made up of 64-bit words. The number of words per line is 8 an...

A: Cache size:The cache size can be calculated using the following formula:

Q: Consider different risk mitigation strategies for system development programs. What type of strategy...

A: Risk mitigation: Let’s start to discuss about the risk . Risk is a possibility of loss which occurre...

Q: What is the difference between the COUNT aggregate function and the SUM aggregatefunction?

A: In database management, an aggregate function is a feature where various row values are grouped toge...

Q: this question is from fundamentals of logic. related to boolean algebra. I am unable to decipher the...

A: Click to see the answer

Q: In a special case of a permutation cipher, we take a message, M, and write its letters in an s× t ta...

A: Given, message M= ATTA CKAT DAWNsecret key S= (3,4)Encryption:arrange the message in table form(3x4)...

Q: Using Java Eclipse do the following program: Design a class named Rectangle to represent a rectangle...

A: Program Instructions:Declare variables width and height.Create a default and parameterized construct...

Q: In Eclipse write a loop which asks 5 integers from user (Scanner) and calculates and prints their av...

A: To input integer value from the scanner class   you need to use Scanner  class which is declared in ...

Q: Do you think technologies like Big Data and Predictive Analytics in Marketing would have worked 10-1...

A: The technologies like Big Data would not have worked 10-15 years back as due to lack of large datase...

Q: Based on a decision tree structure - what are three decisions that may be applicable to a project? w...

A: A decision tree is a supervised learning technique which acts as a decision support tool. It forms a...

Q: It's Java so here's the question Write the code to calculate the total of three int variables a, b, ...

A: To write a program in java, to calculate the sum of given three integer variables and printing their...

Q: Write a program called KiloToPoundTable that prints the below table. Useprintf()and while statement....

A: A constant is defined for holding the conversion factor. printf function is used to format the print...

Q: Describe two concepts for an autonomous transportation and/or delivery that replaces manned systems....

A: Autonomous transportation is the evolution of transport where the vehicles are connected to create a...

Q: Imagine you’d like a contractor to build a software application for you that operates like Windows C...

A: Statement of objectives (SOO):It provides an overall objective which serves as the basis for the sta...

Q: What is DPI

A:  DPI means Dots Per Inch which measures the number of dots placed within squared region of 1-inch di...

Q: Which element is required in a web application to operate the Server-Sent Events? a. c. eventsource...

A: Correct answer:The correct option is “c”.Explanation:“<eventsource>” is the element used in a ...

Q: What is the percent overhead on a T1 carrier? That is, what percent of the 1.544 Mbps are not delive...

A: T1 carrier includes 24 channels with 8 bits for each channel, in which, 7 bits are used for data and...

Q: Consider the three words A, b and c in the network .the host transmits the packet of size 700 bits t...

A: Transmission delay is the time required to upload packets within a network for transmission.Propagat...

Q: Assume that a firm has already implemented a KMS system, as a manager, how do you ensure that learni...

A: Protecting knowledge of the organization is a typically an IP protection problem. From the case stud...

Q: its java  Write the code to calculate t;he average of two int variables a and b and print the result...

A: To calculate the average of two integer values and the resultant will be a floating point number, ex...

Q: Which of the following is true? I. The 80/20 rule states that 80% of the instruction is executed and...

A: 80/20 rule was first introduced by Vilfredo Pareto and therefore in also commonly known as Pareto pr...

Q: public class TestAverage {public static void main(String[] args) {int test1, test2, test3, sum;Scann...

A: The objective of the program is to calculate the average, now since the variable which holds the ave...

Q: Write the following Book class:A Book has-a title, ISBN number, author and price.o Include the follo...

A: All the lines inside this (/* */) field are comments of this program. Read all comments above the co...

Q: Write a program to generate a random number between 1 - 100, and then display which quartile the num...

A: Program Instructions:Use the header files, constants, seed and random number generator given in the ...

Q: Using Java Eclipse IDE do the following program. Programming exercise similar to 9.1, Change Rectang...

A: Programming instructions: First, create a class “Square” and then declare two variables width and co...

Q: What are REST web services and what is the reason for its popularity?

A: REST stands for Representational State Transfer and is an architectural style for most web based app...

Q: Hello, I am trying to write a program: Write a .py file like MainFiles.py In that .py, create a func...

A: A python file is created named as MainFiles.py:Def main( ):Print(“ Welcome to python”)The above pyth...

Q: what is the difference between technology and frame work when it comes to computer engineering?

A: Definition:TECHNOLOGYTechnology, in general refers to the scientific knowledge that is applicable fo...

Q: Which partitioning method must be used for partitioning a 4-TB hard drive?

A: Partitioning 4-TB Hard drive:Hard drive uses two methods for partitioning the drive; they are, Maste...

Q: rewrite the function F = (A ⊕ B) ⊕ C without the XOR operator, ⊕.

A: The XOR operator is defined as 1 ⊕ 1 = 0, 1 ⊕ 0 = 1, 0 ⊕ 1 = 1, and 0 ⊕ 0 = 0. As the output is true...

Q: Identify the errors in the following program. 2 errorspublic class Test {public static void main(St...

A: The two errors in the given program are:The argument is passed in wrong order in the line nPrintln(5...

Q: Assume the following declarations and initializations (MIN, MAX, num) are made just before each sub-...

A: 1. Program plan:Define the class.Define the “main()” function.Initialize the necessary variables.The...

Q: 2) Identify the errors in the following programs a) 3 errorspublic class Test {public static void ma...

A: Hey, since there are multiple questions posted, we will answer first question. If you want any speci...

Q: What is the output of the following code? !doctype html> Find the output ax3 + b2 - c abc ...

A: HTML math tag is used to insert MathML elements inside a webpage. With in <msup> tag those cha...

Q: What is the equivalent 2's complement representation for -15 in 16-bit hexadecimal representation? a...

A: For representing –15 in 2’s complement notation following steps should be followed:Find the binary e...

Q: Imagine you’d like a contractor to build a software application for you that operates like Windows C...

A: Statement of objectives (SOO):It provides an overall objective which serves as the basis for the sta...

Q: How would I solve this problem in python language Grades a) Write a program that reads in the names ...

A: Program Instructions:Use the open() function to read from the file.Save the result o spilt() functio...

Q: In a typical mobile phone system with hexagonal cells, it is forbidden to reuse a frequency band in ...

A: Consider that a typical mobile system is designed with hexagon cells and it is available with 840 fr...

Q: How Technology can help to develop more effective policy?  (Information technology in Global Economy...

A: Information technology:Information technology(IT) has become a very important part of every business...

Q: perform a What-If Analysis on the amount of Saving based on your own scenario.

A: What-if analysis is a backward processing in which, a specific output is provided to find out the in...

Q: Im using python and i need to 1)Fill the function definitions 2) Fill in the missing code in main() ...

A: Program Instructions:Use math.pi to calculate the area and circumference of the circle.Use ‘“{:,.2f}...

Q: Multiple industries are considering the conversion of existing vehicles to autonomously operated veh...

A: Solution:Multiple industries are considering the conversion of existing vehicles to autonomously ope...

Q: Write a program that prompts the user to enter the weight of a person in kilograms and outputs the e...

A: AlgorithmPrompt the user to enter weight in kilogramsAccept the user inputCovert the weight in kilog...

Q: Write the Circle class:• A Circle has a radius– Add instance variable– 2 constructors – one should b...

A: Create a class Circle and define it's instance variable as private type and just declare default con...

Q: .    When troubleshooting a computer hardware problem, which tool might help with each of the follo...

A: 1. In a situation, where the network port is not functioning on a computer, the tool "loopback plug ...

Q: perform a What-If Analysis on the amount of Saving based on your own scenario.

A: What-if analysis is a backward processing in which, a specific output is provided to find out the in...

Q: Write a program in Eclipse that contains 2 methods, main and printLine.

A: Program plan: Import necessary packages.Define a class named “PrintCheck”.Define a method called “pr...

Q: How would i solve this in python i cant figure it out A wall has been built with two pieces of sheet...

A: Program plan:Initialize the length of the small sheetrock in the variable “small”.Initialize the len...