Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please equip the code that I have here with the code that you have. ----------------------------------------------------------------------------------------------------------------- public class MyPhoneMain { public static void main( String[ ]

Please equip the code that I have here with the code that you have.
-----------------------------------------------------------------------------------------------------------------
public class MyPhoneMain
{
public static void main( String[ ] args )
{
MyPhone yours = new MyPhone( "Henry Hall", "5555555555" );
yours.chargeBattery( 120 );
yours.streamAudio( 700 );
yours.chargeBattery( 120 );
yours.streamAudio( 700 );
yours.chargeBattery( 120 );
yours.streamAudio( 700 );
yours.printStatement( );
}
}
-----------------------------------------------------------------------------------------------
* Write a description of class MyPhone here.
*
* @author (your name)
* @version (a version number or a date)
*/
import java.text.DecimalFormat;
import java.text.NumberFormat;
public class MyPhone
{
private int numberOfTexts; // an integer for the number of texts
private double dataConsumed; // a double for the amount of data consumed (in megabytes)
private double batteryLife; // a double for the remaining battery life(between 0.0 and 1.0)
private String customerName; // a String for the customer name (e.g. Amanda Johnson)
private String phoneNumber; // a String for the ten-digit phone number (e.g. 1234567890)
private static final double DATA_PER_MIN = 65 / 60.0; //audio usage per minute
private static final double MAX_MINUTES = 720.0; // for a full battery charge
private static NumberFormat currency = NumberFormat.getCurrencyInstance( );
private static DecimalFormat decimal = new DecimalFormat( "#.##" );
/**
* Initializes the instance variables/fields/members
* to zero and sets the customer name and number to
* the provided parameters.
* Note, phones start with no battery life.
*/
public MyPhone( String name, String num )
{
}
/**
* returns the total number of texts sent or received this month.
*/
public int getNumTexts( )
{
return 0;
}
/**
* returns the remaining amount of battery life,
* should be in the range 0.0 1.0.
*/
public double getBatteryLife( )
{
return 0.0;
}
public double getDataUsage( )
{
return 0.0;
}
public void setName( String n )
{
}
/**
* sets the phone number to n, but only if the String length
* is exactly ten digits(e.g. 1234567890).
*/
public void setPhoneNumber( String n )
{
}
/**
* updates the battery life to reflect a charge
* for mins additional minutes. A full charge
* is completed in two hours (120 minutes).
* Therefore, a 50% charge is completed
* proportionately in sixty minutes.
* Charging the battery longer than two hours
* has no additional effect, battery life should
* never exceed 1.0. Use JOptionPane to display
* the updated battery life as a percentage.
* For example, Battery Life: 89%.
*
* Ignore negative minutes
*/
public void chargeBattery( int mins )
{
}
/**
* calculates the amount of data consumed and battery power
* used to stream the specified minutes of audio. Sixty
* minutes of audio consumes 65 MB of data. A fully charged
* battery will last for twelve hours of audio streaming.
* Update the data and battery life as appropriate. Note,
* the phone could run out of power before streaming all
* of the requested audio. In this case, battery life will
* be 0.0 and only a portion of the requested audio will be
* streamed. If so, use JOptionPane to display a warning.
*
* Ignore negative minutes
*/
public void streamAudio( int mins )
{
}
/**
* increments the text counter. Use JOptionPane to display the text.
*/
public void sendText( String text )
{
}
/**
* Uses JOptionPane to display a short text message of your choice.
* Display a random message (from five options).
*/
public void readText( )
{
}
/**
*
*/
public void printStatement( )
{
}
/**
* resets the appropriate instance members/variables to zero.
*/
private void startNewMonth( )
{
}
/**
* returns the additional data fee which is $15 for each GB
* above the basic 2GB, where data usage is rounded up.
* For example, $15 would be the additional fee for 2.5 GB,
* $45 would be the additional fee for 4.1 GB, and there
* would be no additional fee for 1.99GB.
*/
private double calcAdditionalDataFee( )
{
return 0.0;
}
/**
* returns 3% of the phone service cost, where the phone service cost is $50 plus additional data fees.
*/
private double calcUsageCharge( )
{
return 0.0;
}
/**
* returns the total monthly fee, which is the
* sum of the phone service cost, the usage
* charge, and the administrative fee ($0.61).
*/
private double calcTotalFee( )
{
return 0.0;
}
/**
*
*/
private String fmtPhoneNumber( )
{
return "";
}
}
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed

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

Beginning VB 2008 Databases

Authors: Vidya Vrat Agarwal, James Huddleston

1st Edition

1590599470, 978-1590599471

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago