Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need to compile up a Java program to meet the following requirements: Define a class called Student which contains: Data fields: a) An integer data

Need to compile up a Java program to meet the following requirements:

Define a class called Student which contains:

Data fields:

a) An integer data field contains student id

b) Two String data fields named firstname and lastname

c) A String data field contains student's email address

Methods:

a) A no-arg constructor that will create a default student object.

b) A constructor that creates a student with the specified student id, firstname, lastname and email address

c) A print method that prints student's student id, firstname, Instname and email address.

Here you would have to compile a test class(xxxx_Program) which includes a main() method that will take the students' information from the standard input (keyboard), create and store the information the students' information in an object array, then print the student information from the object array.

The data format of user input is

a) The first entry is the number of students (numeric)

b) The fields below repeat for each student (each field is separated with a space or spaces)

o Student ID (numeric)

o Student first name (String)

o Student last name (String)

o Student email (String) Example:

001 stl firstname st1_lastname s..1@kean.edu

002 st2_firstname st2_lastname s..2@kean.edu

003 st3firstname st3 lastname s..3@kean.edu

004 st4 firstname st4 lastname s..4@kean.edu

005 st5_firstname st5_lastname s..5@kean.edu

The main () method will

a. Read the first line from keyboard, save this number (numberOfStudents) to a variable.

b. Based on the number of students, declare an Student Object array to hold the student objects, and the array size is nubmerOfStudents

c. Using loop statements to read the rest of information for each student create student objects and store the objects in the Object array you created above. (Hint: You can use Scanner class, Scanner's nextInt() method will get integer values, and it's next method will get String values.) d) Using loop statements to print out all student objects from the object array

(Note: If you use the example input above, your output will be like below.)

Students' Information:

001 stl firstname st1_lastname s..1@kean.edu

002 st2_firstname st2_lastname s..2@kean.edu

003 st3firstname st3 lastname s..3@kean.edu

004 st4 firstname st4 lastname s..4@kean.edu

005 st5_firstname st5_lastname s..5@kean.edu

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Business Statistics

Authors: Ronald M. Weiers

7th Edition

978-0538452175, 538452196, 053845217X, 2900538452198, 978-1111524081

More Books

Students also viewed these Programming questions

Question

explain the process of using confrontation, and

Answered: 1 week ago

Question

examine the process of psychological self-regulation,

Answered: 1 week ago

Question

Discuss the five steps of the communication process.

Answered: 1 week ago