Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Programing Homework (Help Please)

tro44_1tro44_1 Member Posts: 1,819

Look at the following problems and identify

a) the output

b) the input

c) the procedure

 

3. Dew Drop Inn, has a different rate structure. Here a guest pays by the week (7 nights). The rate is reasonable - $350. per week. But the guest must always pay for an entire week even if he stays less than the full week. Thus, 4 nights would cost 350. as would 7. If a guest stays 8 nights then he must pay for 2 weeks….or 350 times 2. The tax is still 7.5% and the energy charge is 3.50 per night. . Write a program which will allow you to enter a guest's name and the number of nights he stayed at the Inn. Print an itemized bill which shows the cost for the room, the tax, the energy charge and the total tax.

 

Hint. Since you are entering the number of nights, you will have to convert that to weeks.

HINT: You might be considering "if" for this. (if nights>7 and nights<15, weeks = 2) DON'T DO THIS you would never be able to stop saying "if"….

Think about / which can be used to convert to weeks.

---------------------------------

This is the problem I have above.

The trouble iam having is, how do I use the Night--to--Week conversion to find weekly prices, without using (<|> if/Then) statements?

This is confusing me. 

For example, if the person stayed in  the hotel for 6 days, ---- That would be 6/7 in weeks,

but if I mutiple 6/7 *350, it wont give me the correct weekly price, since that would be less then 350$.

I dont know how to round up numbers using (+ - * / < >) operators.



 

Comments

  • DekronDekron Member UncommonPosts: 7,358

    Just a simple direction - try whatever language's Date() object.

  • sephersepher Member Posts: 3,561

    Use the modulo operator.

    6 % 7 = x

    11 % 7 = y

    254 % 7 = z

    70 % 7 = a

    You'd get x = 6, y = 4, z = 2, a = 0 from the above. So modulo will always tell the number of days short of the last full week.

    So if there was a function you made that accepted an integer and did the following, it'd always pass you the number of days right back presuming you're working with integer types (whole numbers that truncate and not round decimal places, i.e. 3 / 2 = 1 and not 1.5 rounded up to 2)

    x = 6, y = 11, z = 254, a = 70

    ((x / 7) * 7) + (x % 7) = 6 days

    ((y / 7) * 7) + (y % 7) = 11 days

    ((z / 7) * 7) + (z % 7) = 254 days

    ((a / 7) * 7) + (a % 7) = 70 days

     

    'course, dividing and then multiplying by 7 seems redundant there, but its not given the way integers work, i.e. with the 254 days example, 254 / 7 = 36, 36 x 7 = 252. The truncation of decimal places there works to your benefit in giving you the number of days in a full week, and the last modulo operation will give you the number of days in the remaining week.

    That what you were looking for?

  • merlintalormerlintalor Newbie CommonPosts: 3
    The exact moments in favor of getting the idea across would be of the faithful moment as that would be quite convincing methodology representing every type of venture in question. The exacting grade of theme style, schedule of references, citing a scrutiny wrapping english homework solver, letterhead format, sage scrutinize stance and the genuine interest in the responsible for are the biggest factors as a remedy for success.

    The earliest constituent of the college investigate dissertation is the intellectual that is the particular share of the instrument and the puss to the world. It sine qua non be captivated feel interest in a great deal of ways for making the right amount of comments and accurate acutance of the aims and the exploit of the objectives of the paper. The complete skills or buying a custom the form to make unerring comments would originate a series of perspectives on the reader’s demeanor so that they are accomplished to pick out on things.

    The next to enter an introduction is the remarkably viewpoint of how to a postal card a scrutiny typescript and mentions the overall process in regard to getting the aims achieved in the paper. The foremost elements of the periodical must be evaluated and forced to be weakened down into sections so that they can adorn it as a share of the paper. The great breakdown of the introduction section would be free resume service writing perfectly distinguishable as it would upright highlight the elements of the paper.

    The contents point ought to rise as a tree fitted making the virtuous amount of comments and the basic disposition of the researcher for their planning and organizing ability. The tiniest breakdown arrangement on the whole capacity of the organ would be wholly distinguishable and would constitute the remarkably aspects that would be support to end the objectives.
  • LukeGrahamLukeGraham Newbie Posts: 0

    I think you should try the module operator because it is the only manual way to build your program but it's difficult because when we use the tools it will easily generate a program and when we talk about the module then it takes more work as compare to tools. But should not worry now because there are thousands of tools have been introduced in the market which may help you to generate a program which you want. Even now we can easily use the best essay writing help for our projects and work because of thousands of online sites on the internet. These online sites not only help you to complete your work but also help you to get good marks in the exams as well. So, we should visit these sites to get help in our projects.

  • jeff90jeff90 Newbie CommonPosts: 2
    I'm absolutely agree that you need to use the modulo operator, I think as a  hypothesis help it's the best way to do that script.
  • jeff90jeff90 Newbie CommonPosts: 2
    edited September 10
    Right
  • BenCharleyBenCharley Newbie CommonPosts: 1
    edited October 11
    Hi, I’m Ben Charley. I’m a writer living in Newark, New Jersey. I am a fan of technology, music, and writing. I’m also interested in causes and painting.
    ATT support phone number
     

Sign In or Register to comment.