• Post Reply Bookmark Topic Watch Topic
  • New Topic

Inheritance; Problem with Test class  RSS feed

 
charlie beat
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone, I've been working on the program for some time now and i am a bit stuck here unfortunately. My problem is coming from the test class, I simply do not know how to set it up to output the proper information. So first I have to create a Date class, then a Phone class which is the parent of the CellPhone class and LandLinePhone class. I then have to create a test class called PhoneTest. Everything has been completed except for the PhoneTest class which is the one that outputs everything. The PhoneTest I do not know how to properly set it up to output the information that the attached UML and Instructions want me to do. Thanks for looking at my issue, hopefully someone can point me in the correct direction.

First I need to develop the classes according to the UML Provide (ill attach a picture of the UML for a visual representation)

in the PhoneTest class the main method creates the two dimensional string array, calls createPhones, calculates the monthly charge, and calls printBill

The Method printBill prints the information for each instance to the system prompt.

(along with the UML attachment I will also attach the instruction page of the program for better understanding of what I need to do.

--Here are my current programs--














Screen-shot-2012-04-05-at-3.24.17-PM.png
[Thumbnail for Screen-shot-2012-04-05-at-3.24.17-PM.png]
Screen-shot-2012-04-05-at-3.24.25-PM.png
[Thumbnail for Screen-shot-2012-04-05-at-3.24.25-PM.png]
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

You're already 90% of the way there with the assignment. It looks like the only thing left to do is make the printBill method in class PhoneTest, and then call printBill from the main method.

In the printBill method you'll need to loop over all the phones, and for each phone call the methods on it to calculate the amount that has to be printed on the bill. Print a line on the bill for each phone with the relevant information.
 
charlie beat
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it, yes the printBill is what I am stuck on, I am a bit confused on how to work this section of the program, here is what I currently have.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!