помогите решить задачу
вот класс Student
public class Student
{
// Instance Variables
private String lastName;
private String firstName;
private int tardies;
// Default Constructor
public Student()
{
lastName="";
firstName="";
tardies=0;
}
// Second Constructor
public Student(String l, String f, int t)
{
lastName = l;
firstName = f;
tardies = t;
}
// Accessor Methods
public String getLastName()
{
return lastName;
}
public String getFirstName()
{
return firstName;
}
public int getTardies()
{
return tardies;
}
// Mutator Methods
public void setLastName(String l)
{
lastName = l;
}
public void setFirstName(String f)
{
firstName = f;
}
public void setTardies(int t)
{
tardies = t;
}
// toString Method
public String toString()
{
String str;
str = "First Name = " + firstName + "\n" +
"Last Name = " + lastName + "\n" +
"Tardies = " + tardies + "\n";
return str;
}
}
вот класс Tardies
import java.util.*;
public class Tardies
{
// instance variables
private Student[] students; // list of students
private int numStudents; // logical size of the array
// constructor
public Tardies()
{
students = new Student[50]; // instantiate array
numStudents = 0;
}
/** precondition: none
* postcondition: students array has been populated with
* Student objects from keyboard input. numStudents has
* been updated to reflect the logical size of the
* array student.
*/
public void enterData()
{
}
/* @return the total number of tardies for all students
* in the class.
*/
public int getTotalTardies()
{
}
/** precondition: none
* postcondition: a summary report has been printed which includes
* the total number of tardies for the entire class and a
* list of names and tardies for every student in the class.
*/
public void summaryReport()
{
}
public static void main(String[] args)
{
Tardies app = new Tardies();
app.enterData();
app.summaryReport();
}
}
Условие таково ваш учитель попросил создать вас программу которая поможет ему вбивать всех учеников его класса с клавы. максимум 50 студентов но учитель имеет право вбить и меньше
в конце вот что должно выйти
==================
Enter Student Data
==================
Enter last name --> Smith
Enter first name --> Bill
Enter number of tardies --> 5
Enter another student[y/n]? y
Enter last name --> Jones
Enter first name --> Sarah
Enter number of tardies --> 2
Enter another student[y/n]? y
Enter last name --> Sanchez
Enter first name --> Juan
Enter number of tardies --> 3
Enter another student[y/n]? y
Enter last name --> Wallace
Enter first name --> Mary
Enter number of tardies --> 1
Enter another student[y/n]? n
==================================
Class Summary - Tardy Total = 11
==================================
Smith, Bill 5
Jones, Sarah 2
Sanchez, Juan 3
Wallace, Mary 1