rograming language Java. Define a class that represents a smartphone and in particular its battery. The battery has a capacity in mAH (milliamp-hours). This would be a parameter to your constructor. Several features of the phone consume battery power: the screen, voice calling, wifi, and Bluetooth. These can be on or off. When on, they use power as given in the following table: screen 500 mA voice 300 mA wifi 200 mA Bluetooth 100 mA The battery life (in hours) of the phone is its capacity (in mAH) divided by the total power use of all the features that are turned on (in mA). Your class should have a method that computes and returns the battery life given the current settings of the features. The purpose of this question is for you to get practice with objects having both state and behavior. Hint: you should use boolean instance variables to represent the states of each of the four features outlined above. Look up a phone’s battery capacity (for example, 2200 mAH) and write a short main method which demonstrates the features of your class. Your main method should create an instance of a phone with that capacity and print the battery life with all features off. It should then turn some features on and/or off and print the battery life with those settings.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Programing language Java.

Define a class that represents a smartphone and in particular its battery. The battery has a capacity in mAH (milliamp-hours). This would be a parameter to your
constructor. Several features of the phone consume battery power: the screen, voice
calling, wifi, and Bluetooth. These can be on or off. When on, they use power as
given in the following table:
screen 500 mA
voice 300 mA
wifi 200 mA
Bluetooth 100 mA
The battery life (in hours) of the phone is its capacity (in mAH) divided by the total
power use of all the features that are turned on (in mA). Your class should have a
method that computes and returns the battery life given the current settings of the
features. The purpose of this question is for you to get practice with objects having
both state and behavior. Hint: you should use boolean instance variables to represent
the states of each of the four features outlined above.


Look up a phone’s battery capacity (for example, 2200 mAH) and write a short main
method which demonstrates the features of your class. Your main method should
create an instance of a phone with that capacity and print the battery life with all
features off. It should then turn some features on and/or off and print the battery
life with those settings.

Expert Solution
Step 1

According to the information given:-

We have to follow the instruction and program in java.

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY