Computer Science 60-212- Winter 2018 Assignment 4 Due: End of Saturday, April 14
ID: 3699475 • Letter: C
Question
Computer Science 60-212- Winter 2018 Assignment 4 Due: End of Saturday, April 14, 2018 Problem 15 points) Implement a superclass Appointment and subclasses oneTime, Daily, and Monthly. An appointment has a description (for example "see the dentist) and a date. Write a method oeeurson(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill an array of Apointnent objects with a mixture of appointments. Have the user enter date and print out all appointments that occurs on that date Also. provide a tester class, Appintmenttester, for the above classes, in which create various types of appointments and test the expected outputs. Problem 2. (15 points) Consider an interface public interface NumberFornatter String format(int n) Provide four classes that implement this interface as follows: A DetaultFormatter formats an integer in the usual way. A DecinalSeparatortormatter formats an integer with decimal separators; for example, one million as 1,000,000. An necountingFormatter formats negative numbers with parentheses; for example, -1 as (1). A BaseFormatter formats the number in base n, where n is any number between 2 and 16, that is provided in the constructor Also, provide a tester class, FormatTester, that tests above classes using various integer values read from an input file, Nunbers.txt, and creates an output file, FornattedNumbers.txt, and add the formatted numbers into it. For instance if the input file contains: 5 -10000 1000000 36 Then output file, based on the methods you call for these numbers, can contain something like: Default Format: 5 -10000 1000000 36 Decimal Format: 5-10,000 1,000,000 36 Accounting Format: 5 (10000) 1000000 36 Base 8 Format: 5-23420 3641100 44 Base 2 Format: 101 -10011100010000 11110100001001000000 100100Explanation / Answer
//by this way we can classes and subclasses
public class Appointment {
public Appointment(){
System.out.println("See the dentist");
}
public void OccursOn(int year,int month,int day){
if(){
}
}
public class oneTime extends Appointment{
}
public class Daily extends Appointment{
}
public class Monthly extends Appointment{
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.