Due: Wednesday, June 4
Goal: Introduction to Classes and Objects
Create a new class named Student in a file named Student.java. Put the following into the class:
Create another class named Main in a file named Main.java that has the following:
public class Main { public static void main(String[] args) { Student peter = new Student(); peter.setName("Peter"); peter.setResident(true); peter.setNumCredits(12); Student groot = new Student(); groot.setName("Groot"); groot.setResident(false); groot.setNumCredits(9); System.out.println(groot.getName() + " must pay $" + groot.getTuition() + " in tuition."); System.out.println(peter.getName() + " must pay $" + peter.getTuition() + " in tuition."); } }
The program should compile and output how much each student has to pay in tuition.