Java Programming Using seriazation in java Create a class named CellPhone implementing that has 4 data members - load, talkTime (min), ratePerMinute, ratePerText . Define 3 constructors - one is the default constructor , second a constructor that would initialize all the attributes , and third is a constructor that allows the user to initialize all the attributes except the load, instead, directly set load to 300. Also, define getter and setter methods for all attributes.Implement these methods :      (1) callCost that would return the total cost of the call based on the parameter 'duration'     (2) canCall method that returns true if parameter 'duration' (in min) is less than or equal to the available 'talkTime' and you have enough load to complete the call. [HINT: call callCost method and deduct the talkTime]      (3) isLowBat method that returns true if the talkTime is equal to zero      (4) canText method that reduces the load by its ratePerText and returns true if text is successfully sent and it consumes 0.05 minute of the talkTime  and      (5) toString method that would print the remaining load balance      (6) To implement serialization, add writeObject and readObject methods  In a separate class TestCellphone, write a main method (refer to TestPerson class) that works the same as TestPerson class.

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

Java Programming

Using seriazation in java


Create a class named CellPhone implementing that has 4 data members - load, talkTime (min), ratePerMinute, ratePerText .
Define 3 constructors - one is the default constructor , second a constructor that would initialize all the attributes , and third is a constructor that allows the user to initialize all the attributes except the load, instead, directly set load to 300.
Also, define getter and setter methods for all attributes.Implement these methods : 
    (1) callCost that would return the total cost of the call based on the parameter 'duration'
    (2) canCall method that returns true if parameter 'duration' (in min) is less than or equal to the available 'talkTime' and you have enough load to complete the call. [HINT: call callCost method and deduct the talkTime] 
    (3) isLowBat method that returns true if the talkTime is equal to zero 
    (4) canText method that reduces the load by its ratePerText and returns true if text is successfully sent and it consumes 0.05 minute of the talkTime  and 
    (5) toString method that would print the remaining load balance 
    (6) To implement serialization, add writeObject and readObject methods 

In a separate class TestCellphone, write a main method (refer to TestPerson class) that works the same as TestPerson class. 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
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