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

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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