Assignment 5 Instructions
Submit all of your assignments in a zip file. Your zip file must include the .java and .class files as well as a Word document with a screen shot of your program running.
Assignment 5-1 (25 pts.) – Lab Practice 7
⦁ Lab 9-4 (5 pts.) – Create 2 new methods in 2 different classes. Using the supplied VacationScaleTwo class, add the method displayVacationDays() and implement it using a for loop. Test your class with the VacationScaleTwoTest class. Using the supplied NamesListTwo class, add a displayNamesTwo() method and use an enhanced for loop to implement it. Create a NamesTwoListTest class to test your NamesListTwo class.
⦁ Lab 9-5 (10 pts.) – For this exercise, you are to create a class named TwoDimensionalArray that declares, instantiates, and displays a two-dimensional array of integers from 1–10. Your class should have the following 2 public methods (your 10 x 10 array of integers should be private):
⦁ setArray() – this instantiates the array and fills each row of the array with the numbers 1–10 in order.
⦁ displayArray() – displays the contents of the array like the example below:
Submit all of your assignments in a zip file. Your zip file must include the .java and .class files as well as a Word document with a screen shot of your program running.
Assignment 5-1 (25 pts.) – Lab Practice 7
⦁ Lab 9-4 (5 pts.) – Create 2 new methods in 2 different classes. Using the supplied VacationScaleTwo class, add the method displayVacationDays() and implement it using a for loop. Test your class with the VacationScaleTwoTest class. Using the supplied NamesListTwo class, add a displayNamesTwo() method and use an enhanced for loop to implement it. Create a NamesTwoListTest class to test your NamesListTwo class.
⦁ Lab 9-5 (10 pts.) – For this exercise, you are to create a class named TwoDimensionalArray that declares, instantiates, and displays a two-dimensional array of integers from 1–10. Your class should have the following 2 public methods (your 10 x 10 array of integers should be private):
⦁ setArray() – this instantiates the array and fills each row of the array with the numbers 1–10 in order.
⦁ displayArray() – displays the contents of the array like the example below:
Create a separate test class named TwoDimensionalArrayTest to instantiate class TwoDimensionalArray and test it.
⦁ Lab 9-6 (10 pts.) – Using ClassMapTest as your test class, create the ClassMap class and implement the following methods:
⦁ setClassMap() – initializes an array of String called deskArray. deskArray should be a private instance variable within ClassMap. Set the size of deskArray to 10 using a constant named NUMBER_DESKS.
⦁ setDesk() – assigns the name of the student to the current position of deskArray. The name of the student is found in the public instance variable “name.”
⦁ displayDeskMap() – displays the names of the students assigned to each desk in deskArray. Only show those array positions that have students associated with them.
⦁ searchDesk() – searches the deskArray for the position that contains the student named in the “name” instance variable. If the student is not found a message to that affect is printed to the screen.
When you run ClassMapTest your printout should look something like the following:
⦁ Lab 9-6 (10 pts.) – Using ClassMapTest as your test class, create the ClassMap class and implement the following methods:
⦁ setClassMap() – initializes an array of String called deskArray. deskArray should be a private instance variable within ClassMap. Set the size of deskArray to 10 using a constant named NUMBER_DESKS.
⦁ setDesk() – assigns the name of the student to the current position of deskArray. The name of the student is found in the public instance variable “name.”
⦁ displayDeskMap() – displays the names of the students assigned to each desk in deskArray. Only show those array positions that have students associated with them.
⦁ searchDesk() – searches the deskArray for the position that contains the student named in the “name” instance variable. If the student is not found a message to that affect is printed to the screen.
When you run ClassMapTest your printout should look something like the following:
Assignment 5-2 (25 pts.) – Lab Practice 10
⦁ Lab 9-6 Conversion (10 pts.) – overload the setDesk() and searchDesk() methods to accept a String variable called “name” and use this variable to set the ClassMap instance variable “name.” Since you are overloading these 2 methods, you should have 1 set of methods that accepts no arguments and 1 set that accepts a single String argument.
⦁ Lab 10-2 (15 pts.) – Write a Customer class with an overloaded method called setCustomerInfo(). You must overload setCustomerInfo() 3 times (in other words, you must have 3 different setCustomerInfo() methods). Use CustomerTest.java to test your Customer class testing each overloaded method. Write a displayCustomer() method to display the values for each customer you create in CustomerTest (create at least 3 customers).
⦁ Lab 9-6 Conversion (10 pts.) – overload the setDesk() and searchDesk() methods to accept a String variable called “name” and use this variable to set the ClassMap instance variable “name.” Since you are overloading these 2 methods, you should have 1 set of methods that accepts no arguments and 1 set that accepts a single String argument.
⦁ Lab 10-2 (15 pts.) – Write a Customer class with an overloaded method called setCustomerInfo(). You must overload setCustomerInfo() 3 times (in other words, you must have 3 different setCustomerInfo() methods). Use CustomerTest.java to test your Customer class testing each overloaded method. Write a displayCustomer() method to display the values for each customer you create in CustomerTest (create at least 3 customers).
Submit this assignment by 11:59 p.m. (ET) on Monday of Module/Week 5.
Assignment 6 Instructions
Submit all of your assignments in a zip file. Your zip file must include the .java and .class files as well as a Word document with a screen shot of your program running.
Assignment 6-1 (25 pts.)
In this assignment, you are to create a Person class with the following private attributes:
⦁ Last name – type String
⦁ First name – type String
⦁ Social Security Number – type String
⦁ Date of birth – type Date which is a class you create that has the following 3 attributes: int day, int month, and int year and its toString() method returns the date in the “day/month/year” format.
Use a constructor to initialize the Person attributes. Encapsulate each of these attributes and test the setters by using them in the constructor to set the attributes. In the Person class override the Object toString() method so that it will return a String with all of a person’s information when called. Use your getter methods to implement the toString() method (do not access the Person attributes directly from toString(). Test your class by creating a PersonTest class and instantiating 3 different students and then using the toString() method to print out all the information on each student.
Your test run should look like the following:
Submit all of your assignments in a zip file. Your zip file must include the .java and .class files as well as a Word document with a screen shot of your program running.
Assignment 6-1 (25 pts.)
In this assignment, you are to create a Person class with the following private attributes:
⦁ Last name – type String
⦁ First name – type String
⦁ Social Security Number – type String
⦁ Date of birth – type Date which is a class you create that has the following 3 attributes: int day, int month, and int year and its toString() method returns the date in the “day/month/year” format.
Use a constructor to initialize the Person attributes. Encapsulate each of these attributes and test the setters by using them in the constructor to set the attributes. In the Person class override the Object toString() method so that it will return a String with all of a person’s information when called. Use your getter methods to implement the toString() method (do not access the Person attributes directly from toString(). Test your class by creating a PersonTest class and instantiating 3 different students and then using the toString() method to print out all the information on each student.
Your test run should look like the following:
Assignment 6-2 (15 pts.)
In this assignment, you are going to create a subclass of Person called student. The Student class has the following private attributes:
⦁ Student ID – type String. The student ID must be derived using the private method setStudendID() of the Student class. setStudentID() should use the first 2 letters of the student’s last name (converted to upper case) and the last 4 characters of the SSN to derive studentID.
⦁ Course – type String. This is the name of their current class (assume a student can only take 1 class).
⦁ Professor – type String. This is the name of their current professor.
Create a constructor to initialize Student’s attributes and use setters (you need to encapsulate your attributes). In the constructor, use the setter methods to set the attributes rather than setting them directly. The constructor should take the following arguments: first name, last name, SSN, date of birth, course, and professor.
Your test run should look something like the following:
In this assignment, you are going to create a subclass of Person called student. The Student class has the following private attributes:
⦁ Student ID – type String. The student ID must be derived using the private method setStudendID() of the Student class. setStudentID() should use the first 2 letters of the student’s last name (converted to upper case) and the last 4 characters of the SSN to derive studentID.
⦁ Course – type String. This is the name of their current class (assume a student can only take 1 class).
⦁ Professor – type String. This is the name of their current professor.
Create a constructor to initialize Student’s attributes and use setters (you need to encapsulate your attributes). In the constructor, use the setter methods to set the attributes rather than setting them directly. The constructor should take the following arguments: first name, last name, SSN, date of birth, course, and professor.
Your test run should look something like the following:
Assignment 6-3 (10 pts.)
In this assignment, you are going to create an interface called Transcripts with 2 methods: getGPA() and getTotalCredits(). Implement these methods in the Student class you created for Assignment 6-2.
⦁ getGPA()’s return type is double and it returns the value 3.5
⦁ getTotalCredits()’s return type is int and it returns the value 125
Modify the toString() method in Student class to include the student’s GPA and total credits.
Your test run should look something like the following:
In this assignment, you are going to create an interface called Transcripts with 2 methods: getGPA() and getTotalCredits(). Implement these methods in the Student class you created for Assignment 6-2.
⦁ getGPA()’s return type is double and it returns the value 3.5
⦁ getTotalCredits()’s return type is int and it returns the value 125
Modify the toString() method in Student class to include the student’s GPA and total credits.
Your test run should look something like the following:
- CLICK HERE AND ORDER NOW……………………….
- Capitalessaywriting.com is a company which offers academic support and assistance to students. Our mission is to provide high quality academic services to our clients. This is done through quality writing and consistent follow-up of the students’ instructions. At Capitalessaywriting.com, we have highly qualified and competent writers to handle any of your projects. Our past quality projects and assignments ideally speak for themselves.
- CLICK HERE AND ORDER NOW……………………….
Comments
Post a Comment