Write a program containing two classes named student

Assignment Help Programming Languages
Reference no: EM131321956

Write a program containing two classes named student and roster, respectively. The program will maintain a current roster of students within a given course. Student data for the program includes student ID, first name, last name, e-mail address, age, and array of grades. The program you create will read a list of five students, with one of the students being yourself, and use the series of method calls below (see part B3 below). A well-designed program would use the principles of encapsulation and information hiding. Here is the data that will be used from within the main method of your program:

Student ID

First Name

Last Name

E-mail

Age

Grades

1

John

Smith

[email protected]  

20

88, 79, 59 

2

Suzan

Erickson

Erickson_1990@gmailcom  

19

91, 72, 85 

3

Jack

Napoli

The_lawyer99yahoo.com

19

85, 84, 87 

4

Erin

Black

[email protected]

22

91, 98, 82  

5

Your first name

Your last name

Your valid e-mail address

Your age

3 test scores

The data should be input as follows:

String [] students = {"1,John,Smith,[email protected],20,88,79,59",

"2,Suzan,Erickson,Erickson_1990@gmailcom,19,91,72,85",

"3,Jack,Napoli,The_lawyer99yahoo.com,19,85,84,87",

"4,Erin,Black,[email protected],22,91,98,82",

"5,[firstname],[lastname],[emailaddress],[age],[3testscores]"};

Requirements:

A. Include your personal information in the last item of the table above.

B. Create a program that converts the array of Strings shown above to an ArrayList of Student objects. For the Student object class, do the following.

1. Include the following instance variables that describe each student:

• student ID
• first name
• last name
• e-mail address
• age
• array of grades

2. Include the following methods in the Student class:

a. an accessor (i.e., getter) for each instance variable from part B1
b. a mutator (i.e., setter) for each instance variable from part B1

Note: All access and change to the instance variables of the Student class should be through accessor and mutator methods.

c. constructor using all of the input parameters

d. print() to print specific student data (e.g., student ID, first name, last name) using accessors (i.e., getters)

Note: Printing out the grades is optional, not required.

3. Create a student Roster class with the following methods that contain all ArrayList method calls:

a. public static void add(String studentID, String firstname, String lastname, String emailaddress, int age, int grade1, int grade2, int grade3) that sets the instance variables from part B1 and updates the roster

b. public static void remove(String studentID) that removes students from the roster by student ID

Note: If the student ID doesn't exist, the method should print an error message indicating that it is not found.

c. public static void print_all() that prints a complete tab-separated list of student data using accessor methods

Note: Tabs can be formatted as such: 1 [tab] First Name: John [tab] Last Name: Smith [tab] Age: 20 [tab] Grades: {88, 79, 59}. Theprint_all() method should loop through all the students in the student array list and call the print() method for each student.

d. public static void print_average_grade(String studentID) that correctly prints a student's average grade by student ID

e. public static void print_invalid_emails() that verifies student e-mail addresses and displays all invalid e-mail addresses to the user

Note: A valid e-mail should include an at sign ("@") and period (".") and doesn't include a space.

C. Demonstrate the program's required functionality by running the following scenario:

print_all();

print_invalid_emails();

//loop through the ArrayList and for each element:

print_average_grade(current_loop_student);

remove("3");
remove("3");

expected: this should print a message saying such a student with this ID was not found.

Reference no: EM131321956

Questions Cloud

How does the sample size influence the extent : How does the sample size influence the extent to which the sample data can be used to accurately estimate population parameters?
Construct truth table for a four-input odd-parity function : Prove that the NAND gate is universal by showing how to build the AND, OR, and NOT functions using a two-input NAND gate.
Explain the meaning of the regression equation : What is the meaning of the computer printout.- Explain the meaning of the regression equation and the regression line as shown in Table.
Discuss about oratorical leaderst and magic of stereotypes : No one gets through life alone. To some extent, we are all products of our environments. We learn from our families, schools, and cultures. Every person has to face severe challenges and conquer obstacles. How we face our challenges depends on how..
Write a program containing two classes named student : Write a program containing two classes named student and roster, respectively. The program will maintain a current roster of students within a given course.
Calculate the time of adding four 4-bit numbers : Calculate the time of adding four 4-bit numbers to the organization at the top versus the organization at the bottom of Figure B.14.1.
By what factor does the volume change : During the compression stroke of a certain gasoline engine, the pressure increases from 1.00 atm to 20.0 atm. If the process is adiabatic and the air-fuel mixture behaves as a diatomic ideal gas,
Discuss about the racism-sexism and social change : During this module, we saw how powerful race and gender are in defining our identities. Despite advances towards equality, racism and sexism continue to exist in our society.Thinking about these ideas, describe how race and gender shape a person'..
What is the final temperature of the mix : a. What is the final temperature of the mix? b. What is the amount of energy transferred by heat from the iron to the water? c. What are the entropy changes of the water and of the iron?

Reviews

Write a Review

Programming Languages Questions & Answers

  Statements to find array elements are null or not

Write down statements needed to find whether any of the array elements are null or refer to the empty String. Set the variable hasEmpty to true.

  Write program asks user to enter temperature

Write a program that asks the user to enter a temperature, and then shows all the substances that will freeze at that temperature and all the substances that will boil at that temperature.

  Implement and test the human resource information system

Assignment C# Application & Test Report - As part of your development efforts you will prepare and apply a small collection of test cases to verify that the completed application meets some of the key requirements agreed with the client - Your smal..

  Write a prolog program which describes a directed graph

COMP348: PRINCIPLES OF PROGRAMMING LANGUAGES - write a Prolog Program which describes a directed graph (G), with the following structure (shown below) and allows us to ask some questions about this graph.

  Implement an extension to the system

Implement an extension to the system in part(i) in which several name/value pairs are passed from the server and displayed on the client interface.

  What are the advantages and disadvantages of a

what are the advantages and disadvantages of a manufacturing company owning and operating its own outbound warehouse

  Write function concatenation of two strings as its input

Assume f is function which returns result of reversing string of symbols given as its input, and g is function which returns concatenation of two strings given as its input.

  Develop a unit converter to convert both force

Decided on a topic requiring a computer application that includes Excel programming features. Begin the layout and basic structure of the project in class today by laying out tables, equations, user input and output. Try to complete the brainstorm..

  Give the code based on the uml class diagram given

Give the code (in any language) based on the UML class diagram given in 1). As output, you need to display three different messages (e.g., "Panel Word90", Button Word90", and "Textbox Word90") for the generation specified in configuration file.

  Find the total number of products sold for each product

Find the total number of products sold for each product.

  Print how many cars are on the file

print how many cars are on the file (you need to count the link list nodes ) and print every thing about all cares that have been manufactured on 2012 on the a new file called 2012 cares

  Write program that allow user to play a simple guessing game

This assignment will give you practice with while loops and pseudorandom numbers. You are going to write a program that allows the user to play a simple guessing game in which your program thinks up.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd