Question
I have attatched my assignment in the images below. Also, I included the methods that I need for thiis assignment. I included a skeleton of
I have attatched my assignment in the images below. Also, I included the methods that I need for thiis assignment. I included a skeleton of the code. Thank you I hope someone can help.
// This class defines CsusStudent's profile including: name, id, address,
phone, and email
// Csc20 lab 5 assignment
// Csc 20 's Student to provide more inputs here
public class CsusStudent {
// class attributes
private String studentName;
private int studentId;
private String studentAddress;
private String studentPhone;
private String studentEmail;
// constructor
public CsusStudent(String newName, int newId, String newAddress,
String newPhone_number, String newEmail){
}
// setName
public void setName(String newName){
}
// getName
public String getName(){
}
// setID
public void setID(String newID){
}
// getID
public String getID(){
}
// setAddress
public void setAddress(String newAddress){
}
// getAddress
public String getAddress(){
}
// setPhone
public void setPhone(String newPhone_number){
}
// getPhone
public String getPhone(){
}
// setEmail
public void setEmail(String newEmail){
}
// getEmail
public String getEmail(){
}
// toString
public String toString(){
// return a string value by combining all values from class's
attributes
}
}
// This class defines Csc20Student's profile with extension of CsusStudent
// Csc20 lab 5 assignment
// Csc 20 's Student to provide more inputs here
public class Csc20Student extends CsusStudent {
// attributes
private boolean preComputerMajor;
private int numberOfComputerClassUnits;
// constructor
public Csc20Student(String name, int id, String address, String phone,
String email, boolean preCsMajor, int csUnits) {
super(....);
}
// getPreComputerMajor
public boolean getPreComputerMajor () {
}
// setPreComputerMajor
public void setPreComputerMajor (boolean value) {
}
// getNumberofCsUnits
public int getNumberofCsUnits () {
}
// setNumberofCsUnits
public void setNumberofCsUnits (int units) {
}
// toSTring
public String toString(){
// return a string value by combining all values from class's
attributes
}
}
// This Junit is used to validate students's lab 5
// It is also used to demostrate the functionality of Junit as student is
first learning it.
// Author: Doan Nguyen
// Date: 2/16/18
import org.junit.Assert;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
public class CsusStudentTest {
/** Fixture initialization (common initialization
* for all tests). **/
CsusStudent instance;
Csc20Student instance2;
@Before public void setUp() {
instance = new CsusStudent("John Doe", 123, "123 Somewhere", "415-
555-1212", "johndoe@somewhere.com");
instance2 = new Csc20Student("John Doe", 123, "123 Somewhere",
"415-555-1212", "johndoe@somewhere.com",true,15);
instance = instance2;
}
// test getName
@Test public void testGetName() {
String expResult = "John Doe";
String result = instance.getName();
assertEquals(expResult, result);
}
// test getAddress
@Test public void testgetAddress() {
String expResult = "123 Somewhere";
String result = instance.getAddress();
assertEquals(expResult, result);
}
// test getPhone
@Test public void testgetPhone() {
String expResult = "415-555-1212";
String result = instance.getPhone();
assertEquals(expResult, result);
}
// test getEmail
@Test public void testgetEmail() {
String expResult = "johndoe@somewhere.com";
String result = instance.getEmail();
assertEquals(expResult, result);
}
}
// Lab5 tester class
public class Lab5Tester {
public static void main(String[] args) {
CsusStudent student = new CsusStudent("John Doe", 123, "123
Somewhere", "415-555-1212", "johndoe@somewhere.com");
Csc20Student csc20Student = new Csc20Student("John Doe", 123, "123
Somewhere", "415-555-1212", "johndoe@somewhere.com",true,15);
System.out.println(student + " ");
System.out.println(csc20Student + " ");
}
}
Page ot 4 2OOM Lab work (in school laboratory): This lab's objective is to practice building new classes: a. To define constructors. b. To define getter and setter methods c. To build a new class from a super class We also will learn how to use junit to perform automatic unit testing. The two classes CsusStudent and Csc20Student specification (in UML notation - to be discussed in the lecture) are given below
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started