Java Prog anyone? - FirebirdV6.com/CamaroV6.com Message Board

Announcement

Collapse
No announcement yet.

Java Prog anyone?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Java Prog anyone?

    Guys I hate to ask for help, but I caught this cold the other day and I cant think at all. I'm fighting the snot in my nose for control over my nostrils... snot's the lead :/

    Anyway, I have to write this prog due Fri at 12. Here's the requirements. We just learned If/Then statements, so I'm pretty sure we'll have to use those in the prog. I dont necessarily need to have it all done and spoon fed to me, but I definitly do need some help with the basic outline of what should be done.

    Write a program named estimate.vbs that follows these rules for estimating the cost of a house.
    The base cost is $50 per square foot.
    The base cost can very depending on how fancy the house is. Here are some adjustments to make.
    A single story house costs an additional $10 per square foot to build (2 story houses are cheaper)
    Add $10,000 to the total cost if there is a garage.
    Add $2 per square foot if there are hardwood floors.
    Add $5,000 to the total cost if there are custom kitchen cabinets.
    Add $10 per square foot if the house has a basement instead of a crawl space.
    Add $3,000 for each fireplace.
    Your program should prompt for the necessary inputs and output a total cost.


    Thanks for any input

  • #2
    Here's a quick pseudocode I just did. I'm not too familiar with Java, but I'm sure I could help you out more if you need anything else.

    </font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;"> &lt;Input stuff here&gt;



    BaseCost = 50

    if HasBasement then BaseCost = BaseCost + 10

    if HardwoodFloors then BaseCost = BaseCost + 2

    if SingleStory then BaseCost = BaseCost + 10




    TotalCost = SquareFeet * BaseCost




    if HasGarage then TotalCost = TotalCost + 10000

    if CustomCabinets then TotalCost = TotalCost + 5000

    TotalCost = TotalCost + (NumFireplaces * 3000)



    &lt;Output stuff here&gt; </pre>[/QUOTE]Edit: D'oh, it screwed up the empty lines I had to keep it organized...oh well.
    Matt
    1998 Mystic Teal Camaro M5
    Whisper Lid, Pacesetter Headers, Catco Cat, Dynomax Super Turbo, B&M Shifter, BMR STB, LSD, P&P Intakes, GT2 Cam, Comp OE Lifters, 1.7 Roller Rockers, Pushrods, SSM Heads, DHP PowrTuner.

    Comment


    • #3
      would you have to do something like:
      if HasBasement &gt; 0 Then BaseCost = BaseCost + 10

      actually that did help out alot. thanks man

      Comment


      • #4
        HasBasement would be either True or False. If it was true, then "If HasBasement then..." would work, because HasBasement is a 1. You could also say "If HasBasement == 1" or "If HasBasement != 0", etc.

        Note: == is used in C, dunno if Java is like that. ;)
        Matt
        1998 Mystic Teal Camaro M5
        Whisper Lid, Pacesetter Headers, Catco Cat, Dynomax Super Turbo, B&M Shifter, BMR STB, LSD, P&P Intakes, GT2 Cam, Comp OE Lifters, 1.7 Roller Rockers, Pushrods, SSM Heads, DHP PowrTuner.

        Comment


        • #5
          ok yea, you're right. I think I've got it. I know I'm on the right track though. Thanks for the help!

          Comment

          Latest Topics

          Collapse

          There are no results that meet this criteria.

          FORUM SPONSORS

          Collapse
          Working...
          X