• 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

I am stuck on what to do

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having problem and I am stuck on what to do having done in continuation of this work. What must I do to continue.
Write an application for Toyota
a. Display four option combinations of principal amount
i. APR(Annual Percentage Interest)
ii. Number of payments
iii. Payment for month
Three(3), but one will not take a formula.
Any three enter, the fourth should be calculated
Saved the four values somewhere in your program
b. When you buy a Toyota, you want it to display different payment
1. Principal, APR, # of payment, monthly payment
2. APR, monthly payment, # of payment
3. APR, principal
Saved or print value on screen or paper



Deliver the:
Junit
Code
UML

 
Bartender
Posts: 242
27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm having a hard time understanding the instructions. It sounds like you need to take user input for APR and number of payments, then calculate payment for month and then display these values to the user when they want to buy a Toyota? Assuming this is correct:

- They want you to declare a Toyota class which will hold those three values as a field. The code you posted basically tells you how to do that, though you'll need to choose a variable type to store them (APR and monthly payment probably need decimal places, while number of payments probably doesn't)
- To receive user input, use a Scanner. Convert this input into the desired datatype, and then create a new Toyots with those fields (you probably want to add a Toyota constructor which initiates those fields)
- Ask the user for what they want to buy (the design for this is up to you) and then display whichever values they wanted to see. Displaying them could be done either in the main or in the Toyota class.

You should write tests for this, as they ask for a JUnit along with it. You'll want to do unit testing on all of the Toyota's methods. Make sure it gets initiated correctly, and make sure it returns the right data. You also should make a UML diagram before (as a reminder: make a box for every class, write its name, instance variables, and methods. Minus sign for private, plus sign for public). You'll likely only need a main method for the driver class so the UML will be primarily for the Toyota class.

(Also in your OP: why are you creating an inner class called Main? You already have a main method outside)
 
Bartender
Posts: 5466
212
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm, like Zachary, I am also having trouble understanding this assignment.

Anyway, there are four variables to deal with: the principal, the APR, the monthly payment and the number of payments.
Given any three of these, it is possible to calculate the fourth (calculating the APR given the other three might be a little harder though).
Do you know the required formulas?

Shouldn't the principal (i.e. the price of the thing?) be a field of 'Toyota' too? And in that case don't you need four constructors, in which any takes three of the four variables?
 
Marshal
Posts: 79278
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

I added code tags to your post and the make the code look better. Unfortunately what you posted is incomplete; you should for example declare types for all those fields in the first class.
 
Ebenezer Y Teah
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks. I am reposting the modifications to the instructions.
I am having problem and I am stuck on what to do having done in continuation of this work. What must I do to continue. These are the modifications to the instruction:
Four methods.
i. Find APR(number of payments, capital, monthly payment) produces APR
ii. Find Number of payments(APR, capital, monthly payment) produces number of payments
iii. Find Capital(APR, number of payments, monthly payment) produces capital
iv. Find Monthly payment(APR, number of payments, capital) produces monthly payment
Any three of the method enter the fourth should be calculated. One of the three will not take a formula.








Saved or print value on screen or paper

Deliver the:
Junit
Code
UML
 
Ebenezer Y Teah
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The fourth that is calculated would be considered as the finance calculator
 
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From what I can understand, you are supposed to have four methods, each taking three arguments and returning the fourth. Why don't you start by writing one of the methods?

Note on your post: the code tags should surround your code. Follow the link in Campbell's post for more information.
 
Campbell Ritchie
Marshal
Posts: 79278
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knute Snortum wrote:. . . the code tags should surround your code. Follow the link in Campbell's post for more information.

I have corrected it for you this time. You do not appear to ahve got very far; please show us what you have achieved.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic