So I am taking a class that just started us out in Java. We have been using Alice for most of the class which is completely different so I am extra confused when dealing with some raw code. I have an assignment question that she wants answered but I need some help. The question is.
Code a simple class in JAVA classed “Student.” Your class must contain the followings (20 points):
· Variables (name, age, addressStreet, city, state, zip, country)
· Setter and Getter methods
This is an all online college that I am taking so it is difficult to communicate with instructors and get prompt feedbacks, at least with this class. I have a basis for what I have started and it may be ok but I am still unsure if what I am doing is right. I don't know if this means I have to include fake names for the getters so I included them anyway. Someone please point me in the right direction! Here is my progress thus far.
public class Student { private String name; private String age; private String addressStreet; private String city; private String state; private String country; private int zip; /** * This method is demonstrating a simple class clabeled "Student" * * */ public void setName(String name) { this.name = "Gig Harbor"; } public String getName(){ return name; } public void setAddressStreet(String address) { this.addressStreet = "555 Blah Blah Lane"; } public String getAddressStreet(){ return addressStreet; } public void setCity(String cityName) { this.city = "Gig Harbor"; } public String getCity(){ return city; } public void setState(String stateName) { this.state = "Washington"; } public String getState(){ return state; } public void setZip (String zipName) { this.zip = "98446"; } public String getZip(){ return zip; } public void setCountry (String countryName) { this.country = "USA"; } public String getCountry(){ return country; // Public void's are setters and public String are getters. } }