• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Inheritance; Problem with Test class

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic