This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

can someone help me with this program  RSS feed

 
Kristina Dzhangiryan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Green Fields Landscaping Company sells evergreen trees which are priced by height. Customers have a choice of purchasing a tree and taking it home with them or purchasing a tree and having it delivered. Write a program that asks the user the number of trees purchased, the height of the trees, and if they want the trees delivered. Based on that information the program should then generate an invoice. Assume that ALL the trees purchased by a customer are the same height.

Tree Pricing Information

Under 3 Feet Tall


39.00 (tax included)

3 to 5 Feet Tall


69.50 (tax included)

6 to 8 Feet Tall


99.00 (tax included)

Over 8 Feet Tall


199.50 (tax included)

Additional Fee for Delivery


If the number of trees purchased is less than five the delivery fee is 10.00 * the number of trees purchased

If the number of trees purchased is five or more the delivery fee is 50.00

I CANT USE CHAR THOUGH.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, and welcome to the Ranch!

Here are a couple of tips to help you get the most out of your time here.

1. TellTheDetails(←click). Folks here don't want to have to guess at what specific bit you're having trouble with, so the clearer and more precise you are about your requirements and constraints and what you're stuck on, the more people will be willing and able to help you..

2. ShowSomeEffort(←click). We expect you to take your best shot at your work, and show us what you've tried. That combined with the details from #1 puts everybody at a good starting point to guide you toward solving your own problem.
 
Kristina Dzhangiryan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


now im completely stuck especially on the yes or no part and also on the decimal format
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That really doesn't help us understand what your specific difficulty is.

Also, now that you've posted code, I can give you another tip! UseCodeTags(←click). That turns your code from unreadable to readable. I've put them in for you this time.
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Crossposting.
 
Winston Gutkowski
Bartender
Posts: 10573
65
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kristina Dzhangiryan wrote:now im completely stuck especially on the yes or no part and also on the decimal format

Actually, you have problems a lot earlier than that:

numTrees = keyboard.nextLine(numTrees);

What type does keyboard.nextLine() return?
What type is numTrees?

A couple of general tips:
  • STOP CODING, and write out what you need to do in English (or your native language) and in detail. You will never solve a problem by simply coding.
  • When you do finally turn your computer back on, DON'T write more than a few lines of code without compiling. That way, you won't be dealing with reams of compiler errors.

  • BTW, a hint for the problem I highlighted above: Have a look at the Integer class (java.lang.Integer).

    Winston
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!