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
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images
- •is Valid Phone Number(): ReturnsTrue if the provided phone number (represented as a string) is cor-rectly formatted, otherwiseFalse. To be considered correctly formatted, phone numbers must bewritten as###-###-####, where#is a digit between 0 and 9 .•validatePhoneBook(): A phone book is a list where each entry is a phone book record (represented asa dictionary; see below for more details). This function checks each phone book record in the phonebook for correctly formatted phone numbers.A phone book record is a dictionary which initially has two keys: the key"name"mapped to thecontact’s name (string) and the key"phone number"mapped to that contact’s phone number (alsoa string).validatePhoneBook()adds a new key"valid"to the record with the valueTrueif the phonenumber is formatted correctly, otherwiseFalse. 1. Write white-box and black-box tests for the function is ValidPhoneNumber(). You should do this with-out Python, either on paper, or in a simple document. Don’t worry about…arrow_forwardThe UML of KeanPerson is provided below: #keanld: int #keanEmail : String #firstName : String #lastName: String KeanPerson +KeanPerson() +KeanPerson(keanld: int, keanEmail : String, firstName: String, lastName : String) 4 getKeanld(): int + getKeanEmail() : String + getFirstName + getLastNamed + setFirstName(firstName : String) : void + setLastName(lastName : String) void + to String(): String Write a child class of the KeanPerson: KeanFaculty KeanFaculty has an additional property: salary. a) Implement instance variable (embed Data Encapsulation) b) Implement two constructors c) Implement getters and setters d) Implement toString() method Edit View Insert Format Tools BI BIU 12pt - Paragraph Table wwwarrow_forward// FILE: IntSet.h - header file for IntSet class// CLASS PROVIDED: IntSet (a container class for a set of// int values)//// CONSTANT// static const int MAX_SIZE = ____// IntSet::MAX_SIZE is the highest # of elements an IntSet// can accommodate.//// CONSTRUCTOR// IntSet()// Pre: (none)// Post: The invoking IntSet is initialized to an empty// IntSet (i.e., one containing no relevant elements).//// CONSTANT MEMBER FUNCTIONS (ACCESSORS)// int size() const// Pre: (none)// Post: Number of elements in the invoking IntSet is returned.// bool isEmpty() const// Pre: (none)// Post: True is returned if the invoking IntSet has no relevant// relevant elements, otherwise false is returned.// bool contains(int anInt) const// Pre: (none)// Post: true is returned if the invoking IntSet has anInt as an// element, otherwise false is returned.// bool isSubsetOf(const IntSet& otherIntSet) const//…arrow_forward
- When we use the Group-Object cmdlet, it will create this new property, which displays the number of objects in each grouping: Group of answer choices Number Count Entry Namearrow_forwardCharge Account ValidationCreate a class with a method that accepts a charge account number as its argument. The method should determine whether the number is valid by comparing it to the following list of valid charge account numbers:5658845 4520125 7895122 8777541 8451277 13028508080152 4562555 5552012 5050552 7825877 12502551005231 6545231 3852085 7576651 7881200 4581002These numbers should be stored in an array. Use a sequential search to locate the number passed as an argument. If the number is in the array, the method should return true, indicating the number is valid. If the number is not in the array, the method should return false, indicating the number is invalid.Write a program that tests the class by asking the user to enter a charge account number. The program should display a message indicating whether the number is valid or invalid.arrow_forwardpublic String firstAndLast(String str) { //declare and create your first char //declare and create your second char //return your first and last char as a String }arrow_forward
- True or False ___(10) The term length( ) in the String class is a method that returns the total number of characters in a string. ___(11) If variable name contains string “Valentino”, then the expression name.substring(3, 5) is “ent”. ___(12) Java initializes all variables when they are declared.arrow_forwardMadLib Game bigGame.py Write a program that plays a MadLib game with the user. The program should ask the user to enter the following words: A plural noun (PNOUN1) A person’s first name (FNAME) A noun (NOUN1) A person’s last name (LNAME) A second plural noun (PNOUN2) A place (PLACE1) A third plural noun (PNOUN3) Another place (PLACE2) A fourth plural noun (PNOUN4) A second noun (NOUN2) An adjective (ADJECTIVE1) A second adjective (ADJECTIVE2) A verb (VERB) A third adjective (ADJECTIVE3) After the user has entered these items, the program should display the following story, inserting the user’s input into the appropriate locations: Hello there, sports PNOUN1!This is FNAME, talking to you from the press NOUN1in LNAME Stadium, where 57,000 cheering PNOUN2Have gathered to watch (the) PLACE1 PNOUN3take on (the) PLACE2 PNOUN4.Even though the NOUN2 is shining, it’s a/an ADJECTIVE1cold day with the temperature in the ADJECTIVE2 20s.We’ll be back for the opening VERB -off after a few…arrow_forwardThe program must include two classesclGradesGraph and GradesGrapghDemo. GradesGraphDemo (one method)- Main method only GradesGraph- Include at least 4 methods (No credits without at least 4 methods!!!) Create a class that represents the grade distribution for a given course. In this class you should write methods to perform the following tasks: Read the number of each of the letter grades A, B, C D and F Set the number of letter grades A, B, C, D and F Return the total number of grades Return the percentage of each letter grade as a whole number between 0 and 100 inclusive Draw a bar graph of the grade distributionThe graph should have five bars, one per grade. Each bar can be a horizontal row of asterisks, such that the number of asterisks in a row is proportionate to the percentage of grades in each category. For example, let on asterisk represent 2%, so 50 asterisks correspond to 100%. Mark the horizontal axis at 10% increments from 0 to 100% and label each line with a letter…arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY