Description
The following workshop lets you practice basic java coding techniques classes and objects in more depth.
Task 1: (Difficulty level – Easy)
Design a class named MyInteger. The class contains:
- An int data field named value that stores the int value represented by this object.
- A constructor that creates a MyInteger object for the specified int
- A getter method that returns the int
- The methods isEven(), isOdd(), and isPrime() that return true if the value in this object is even, odd, or prime, respectively.
- The static methods isEven(int), isOdd(int), and isPrime(int) that return true if the specified value is even, odd, or prime, respectively.
- The static methods isEven(MyInteger), isOdd(MyInteger), and isPrime(MyInteger) that return true if the specified value is even, odd, or prime, respectively.
- The methods equals(int) and equals(MyInteger) that return true if the value in this object is equal to the specified value.
- A static method parseInt(char[]) that converts an array of numeric characters to an int
- A static method parseInt(String) that converts a string into an int
Write a client program that take input from the user as an integer and then check all the methods you have designed.
Task 2: (Difficulty level – Easy)
Create class Date with the following capabilities:
Output the date in multiple formats, such as
- Use overloaded constructors to create Date objects initialized with dates of the formats in part (a).
- In the first case the constructor should receive three integer values.
- In the second case it should receive a String and two integer values.
- In the third case it should receive two integer values, the first of which represents the day number in the year.
Your program should make sure that all the input values are in proper range, like Months should be between 1 to 12 etc.
Note: Your programs should make sure that the inputs from the user are legit in case user is giving you string value instead of integer then your program appropriately let the user know about wrong input and ask for the correct input again.
Continue to the next page…
Workshop Header
/**********************************************
Workshop #
Course:<subject type> – Semester
Last Name:<student last name>
First Name:<student first name>
ID:<student ID>
Section:<section name>
This assignment represents my own work in accordance with Seneca Academic Policy.
Signature
Date:<submission date>
**********************************************/
Code Submission Criteria:
Please note that you should have:
- Appropriate indentation.
- Proper file structure
- Follow java naming convention
- Document all the classes properly
- Do Not have any debug/ useless code and/ or files in the assignment
Deliverables and Important Notes:
All these deliverables are supposed to be uploaded on the blackboard once done.
- You are supposed to create video/ record voice/ detailed document of your running solution. (50%)
- Screen Video captured file should state your last name and id, like Ali_123456.mp4 (or whatever the extension of the file is)
- Detailed document should include screen shots of your output, have your name and id on the top of the file and save the file with your last name and id, like Ali_123456.docx (or whatever the extension of the file is)
- A word/ text file which will reflect on learning of your concepts in this workshop.
(30%)
- Should state your Full name and Id on the top of the file and save the file with your last name and id, like Ali_123456.txt
- Submission of working code. (20%)
- Make sure your follow the “Code Submission Criteria” mentioned above.
- You should zip your whole working project to a file named after your Last Name followed by the first 3 digits of your student ID. For example, zip.
- Your marks will be deducted according to what is missing from the above-mentioned submission details.
- Late submissions would result in additional 10% penalties for each day or part of it.