Question

( Object array + input) Write a Java program to meet the following requirements: 1. Define...

( Object array + input) Write a Java program to meet the following requirements:
1. Define a class called Student which contains:
1.1 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
1.2 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, lastname and email address.
2. Write a test class(xxxx_ Program5) 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.
2.1 The data format of user input is
 The first entry is the number of students (numeric)
 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:
5
001 st1_firstname st1_lastname st1@kean.edu
002 st2_firstname st2_lastname st2@kean.edu
003 st3_firstname st3_lastname st3@kean.edu
004 st4_firstname st4_lastname st4@kean.edu
005 st5_firstname st5_lastname st5@kean.edu
2.2 The main() method will
(1) Read the first line from keyboard, save this number (numberOfStudents) to a variable.
(2) Based on the number of students, declare an Student Object array to hold the student objects, and the
array size is nubmerOfStudents.
(3) 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.)
(4) 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 st1_firstname st1_lastname st1@kean.edu
002 st2_firstname st2_lastname st2@kean.edu
003 st3_firstname st3_lastname st3@kean.edu
004 st4_firstname st4_lastname st4@kean.edu
005 st5_firstname st5_lastname st5@kean.edu

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
( Object array + input) Write a Java program to meet the following requirements: 1. Define...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Using Python: Par 1. You will define Student class with the following attributes: CWID: the student’s...

    Using Python: Par 1. You will define Student class with the following attributes: CWID: the student’s CWID FirstName: the student’s first name LastName: the student’s last name Gender: the student’s gender (‘M’ or ‘F’) BirthDate: the student’s date of birth (e.g. ‘03/14/1999’) ClassID: the class id that the student took ClassDate: the date when the student took the class (e.g. ‘01/26/2018’) Grade: the student’s grade for the class In addition, you will do the following tasks: Implement a set of...

  • Write this in Java. say i have a file called "file.txt" that looked like this: Dunn...

    Write this in Java. say i have a file called "file.txt" that looked like this: Dunn Sean 31111 Duong Geoffrey 29922 Fazekas Nicholas 31100 Prezioso Stefano 22223 Puvvada Mohana 11224 and i have an object class called Student, with three String fields lastName, firstName, and ID. i want to read in file.txt from another class (preferably using BufferedReader) and store each line in the file as a Student in a Student array (example: first line gets stored as ("Dunn" ,...

  • Input hello, I need help completing my assignment for java,Use the following test data for input...

    Input hello, I need help completing my assignment for java,Use the following test data for input and fill in missing code, and please screenshot output. 1, John Adam, 3, 93, 91, 100, Letter 2, Raymond Woo, 3, 65, 68, 63, Letter 3, Rick Smith, 3, 50, 58, 53, Letter 4, Ray Bartlett, 3, 62, 64, 69, Letter 5, Mary Russell, 3, 93, 90, 98, Letter 6, Andy Wong, 3, 89,88,84, Letter 7, Jay Russell, 3, 71,73,78, Letter 8, Jimmie Wong,...

  • Language Java Step 1: Design a class called Student. The Student class should contain the following...

    Language Java Step 1: Design a class called Student. The Student class should contain the following data: firstName lastName studentID totalCredits gpa Your class should implement the “sets” and “gets” for the class. Include methods: equals, compareTo, toString. Change the toString method (from class) to put each member variable on a new line. Step 2: Write a driver program to test that Student works correctly. Test is with 3 students as given in class. Step 3: Write a “registration” program...

  • Create a Java program for a school. Create a report containing information for a classroom. For...

    Create a Java program for a school. Create a report containing information for a classroom. For each classroom, the report will contain: the room number, the teacher and subject to the class, and a list of students assigned to the class and their grade. Create a directory called “SchoolInfo". Create Displayable interface. The interface should declare one method Create Person (abstract) class String firstName String lastName. (other classes will implement this one) Create the Teacher class, name and subject Create...

  • In Java(using BlueJ) Purpose Purpose is to practice using file input and output, and array list...

    In Java(using BlueJ) Purpose Purpose is to practice using file input and output, and array list of objects. Also, this lab specification tells you only what to do, you now have more responsibility to design how to do it. Problem description You are given a text file called 'Students.txt' that contains information on many students. Your program reads the file, creating many Student objects, all of which will be stored into an array list of Student objects, in the Students...

  • redo program 1(what I have type on bottom to meet the following requirements) it must not...

    redo program 1(what I have type on bottom to meet the following requirements) it must not interact with the user to receive inputs for efficiency in testing programs, while meeting the following requirements. in c++ Employee class Change the struct data type Employee to a class with all preexisting attributes(, or data members, or data fields) and an additional data member named count that keeps track of the number of Employee objects. Implement the interface that include the following functionalities...

  • In Java: Develop a simple class for a Student. Include class variables; StudentID (int), FirstName, LastName,...

    In Java: Develop a simple class for a Student. Include class variables; StudentID (int), FirstName, LastName, GPA (double), and Major. Extend your class for a Student to include classes for Graduate and Undergraduate. o Include a default constructor, a constructor that accepts the above information, and a method that prints out the contents FOR EACH LEVEL of the object, and a method that prints out the contents of the object. o Write a program that uses an array of Students...

  • Description: This Java program will read in data from a file students.txt that keeps records of...

    Description: This Java program will read in data from a file students.txt that keeps records of some students. Each line in students.txt contains information about one student, including his/her firstname, lastname, gender, major, enrollmentyear and whether he/she is a full-time or part-time student in the following format. FIRSTNAME      LASTNAME        GENDER              MAJORENROLLMENTYEAR FULL/PART The above six fields are separated by a tab key. A user can input a keyword indicating what group of students he is searching for. For example, if...

  • In Java programming language Please write code for the 6 methods below: Assume that Student class...

    In Java programming language Please write code for the 6 methods below: Assume that Student class has name, age, gpa, and major, constructor to initialize all data, method toString() to return string reresentation of student objects, getter methods to get age, major, and gpa, setter method to set age to given input, and method isHonors that returns boolean value true for honors students and false otherwise. 1) Write a method that accepts an array of student objects, and n, the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT