Question: Class Specifications The design specification of a class includes: 1) declarations for a list of instance fields (think of these as nouns) and 2) method

 Class Specifications The design specification of a class includes: 1) declarations

for a list of instance fields (think of these as nouns) and

Class Specifications The design specification of a class includes: 1) declarations for a list of instance fields (think of these as nouns) and 2) method declarations (think of these as verbs), including parameters, which determine how objects are used. Implement a class, called MyPhone, with the following instance fields and methods. Do not create additional methods or make any changes to the following requirements. If you do, the automated tests will likely fail. Class Fields Declare meaningful names with appropriate data types for each of these private instance fields: an integer for the number of texts a double for the amount of data consumed (in megabytes) . a double for the remaining battery life (a value between 0.0 and 1.0) * a String for the customer name (e.g. "Amanda Johnson") * a String for the ten-digit phone number (e.g. "6163319999") * final doubles for the administrative fee, universal usage charge and base fee. Example private final double ADMINFEE-0.61; two final doubles for the video and audio usage per minute. For example private final double VIDEO-DATA-PER-MIN = 250 / 60.0; two final doubles for the maximum minutes of video and audio usage for a full battery charge. For example, audio streaming will last fifteen hours on a full charge . private final double AUDIO_MINUTES900.0; Phase 1 (20 pts) Constructor A constructor is a special method with the same name as the class and generally initializes the fields to appropriate starting values. Refer to section 5.8 . public MyPhone (String name, String num -this constructor initializes some of the instance members to zero and sets the customer name and number to the provided parameters. The phone starts fully charged (i.e. 1.0) Accessor Methods An accessor method does not modify class fields. The names for these methods, which simply return the current value of a field, often begin with the prefix get'. Refer to section 5.7 . public String getName ) - returns the customer name . public String getNumber - returns the phone number . public int getNumTexts returns the number of texts sent and received. . public double getBatteryLife -returns the remaining battery life . public double getDataUsage returns the amount of data used so far this month in megabytes (MB)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!