Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

DayofWeek class: public class DayOfWeekDisplay { private DisplayAI dayInWeek; // AI for days private HashMap daysOfWeek; // keeps the names of the days /** *

image text in transcribed

DayofWeek class:

public class DayOfWeekDisplay { private DisplayAI dayInWeek; // AI for days private HashMap daysOfWeek; // keeps the names of the days

/** * Constructor for objects of class DayOfWeekDisplay *

WeekDay class:

public class WeekDisplay { private DisplayAI weekInYear; // AI for weeks

/** * Constructor for WeekDisplay objects. The constructor * sets up the AI and the current week of the year. */ public WeekDisplay(int w) { // put your code here }

/** * This method makes the display advance by one week. */ public void nextWeek() { // put your code here }

/** * Return the current week. */ public String getWeek() { return calculateString(); } /** * Calculate the string that represents the week of the year, * in the format "ww", e.g. "02" (not "2") or "16". */ private String calculateString() { return "TO DO"; } }

DisplayAI class:

public class DisplayAI { private int limit; private int value;

/** * Constructor for objects of class DisplayAI. * Set the limit at which the display rolls over. */ public DisplayAI(int rollOverLimit) { limit = rollOverLimit; value = 0; }

/** * Return the current value. */ public int getValue() { return value; }

/** * Increment the display value by one, rolling over to zero if the * limit is reached. */ public void increment() { value = (value + 1) % limit; } /** * Set the value of the display to the new specified value. If the new * value is less than zero or over the limit, do nothing. */ public void setValue(int replacementValue) { if((replacementValue >= 0) && (replacementValue

Now modify the two classes a) DayOfWeekDisplay i. The DayOfWeekDisplay class should use Number Display to circle thru the days of the week and to display them as Monday" ... "Sunday". ii. In the constructor you need to properly initialize Number Display and to populate the HashMap. Implement the methods nextDay and getDay. b) WeekDisplay i. The WeekDisplay class should use Number Display to circle thru the weeks of the year (and to display them as "01"... "52". ii. Implement the constructor. Implement the methods nextWeek and calculate String. Now modify the two classes a) DayOfWeekDisplay i. The DayOfWeekDisplay class should use Number Display to circle thru the days of the week and to display them as Monday" ... "Sunday". ii. In the constructor you need to properly initialize Number Display and to populate the HashMap. Implement the methods nextDay and getDay. b) WeekDisplay i. The WeekDisplay class should use Number Display to circle thru the weeks of the year (and to display them as "01"... "52". ii. Implement the constructor. Implement the methods nextWeek and calculate String

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Online Systems For Physicians And Medical Professionals How To Use And Access Databases

Authors: Harley Bjelland

1st Edition

1878487442, 9781878487445

Students also viewed these Databases questions

Question

Would I say yes to this message?

Answered: 1 week ago