Devam Ediyor

501970 The Extended Time Zone class

STEP 1: Create a New Project

Create a new project which consists of two classes; the base Time class and a derived extTime class.

The base class should have data members that are used to represent the hour and the minute both of type integer. The derived class has one additional data member that represents the time zone. This data member should have a string data type.

STEP 2: Create and define member functions

Create a function for each of the operations listed below:

Base class:

* set the time

* return the time

* print the time

* increment the hour

* increment the minute

* a default constructor and a constructor with parameters.

Derived class: should have (in addition to the classes above) its own

* print which prints the time zone in addition to the time

* constructor

STEP 3: Construct Main Method

Construct the main method so that it can test the member functions of each of the parent and the child class by instantiating objects of these classes and calling the appropriate functions.

STEP 3: Create the Base Time Class

Back to top

Using the Class diagram, create the base Time class using the following specifications.

Create a property to set and get the hour attribute.

Create a property to set and get the minute attribute.

Create a default constructor that sets the hour to 12 and minute to 0.

Create a parameterized constructor that accepts the hour and minute and sets the appropriate attribute.

The increment hour method will take an integer parameter which is the hours to be added. The method needs to check if the increment is greater than 23 hours since the clock will need to roll over to the next day, but the hour should never be greater than 23 [Hint: use the modulus operator (%).] Also, if the incremented hour is less than zero, set the value to the appropriate value. For example, if the current hour is 3 and the increment is -4, the new hour would be 23.

The Increment minutes method will take an integer parameter which is the minute to be added. If the number of minutes is greater than 60, then calculate the number of hours and minutes, and add the hours to the hour attribute [Hint: use the modulus operator]. If the calculated minutes is less than zero, then reset the minutes to 0 and notify the user.

The displayTime method will display the time in 24-hour format, such as "23:45".

STEP 4: Create the ExtendedTime Class

Back to top

Using the Class diagram, create the derived ExtendedTime class using the following specifications.

Create a property to set and get the time zone.

Create a default constructor that invokes the base class default constructor, and then sets the time zone to CDT (Central Daylight Time).

Create a parameterized constructor that accepts the hour, minute, and time zone, and invokes the base class constructor to initialize the hour and minute, and then initialize the time zone attribute.

The displayTime method should invoke the base class displayTime method and then add the time zone to the output message.

STEP 5: Create the Windows Interface Form

Back to top

Add a new form, called “frmTime” to the project.

Create a form level object variable that holds the default Time attributes.

Create a form level variable that holds the default ExtendedTime attributes.

Provide textbox input fields for each of the attributes in the Time and ExtendedTime classes. Ensure that each input is appropriately validated and the program only stores valid inputs. As the inputs are validated, store the data into both the form level Time and Extended object variables.

Ensure each textbox has a label describing the purpose of the input field (called a label, field pair).

Create an Hour increment label, input a field that accepts only numbers, and after the hour values are validated, store the hour in the form level Time and ExtendedTime object variables.

Create a Minute increment label, input a field that accepts only numbers, and after the minute values are validated, store the hour in the form level Time and ExtendedTime object variables.

Create a list box, or combo box, that holds the valid U.S. time zones, and when the user selects the time zone, store the selected value in the ExtendedTime object variable.

Create a method called “DisplayInformation” that uses the form level Time and ExtendedTime objects, and then displays the objects information (you can use a label on the form, or a messagebox).

Add a command button called “btnDisplayTime” and event handler that invokes the DisplayInformation method by passing in the form level Time object variable.

Add a command button called “btnDisplayExtendedTime” and event handler that invokes the DisplayInformation method by passing in the form level ExtendedTime object variable.

Create a command button called “btnNewTime” and event handler that when clicked, re-instantiates the form level Time and ExtendedTime objects using the information contained in input fields to initialize the objects fields. This command button should only be enabled once all the input fields contain valid data.

Add a command button that will clear all input fields.

Add a command button that will exit the application.

Please contact me for questions if necessary.

Beceriler: Her şey Kabul, C Programlama, C# Programlama, PHP

Daha fazlasını görün: zero-zone, variable programming, variable in programming, top level diagram, test the application, string the, re label, project handler, programming variables, programming variable, programming test questions, programming operator, programming diagram, programming define, programming classes, programming class, pair programming, modulus programming, event programming, define programming, define c programming, data input operator, c programming string functions, c programming operator, c programming modulus

İşveren Hakkında:
( 2 değerlendirme ) Lewisville, United States

Proje NO: #2247891

Seçilen:

AcrossSloution

let start

1 gün içinde 25$ USD
(0 Değerlendirme)
0.0