subject

Suppose we can buy a chocolate bar from the vending machine for $1 each. Inside every chocolate bar is a coupon. We can redeem six coupons for one chocolate bar from the machine. This means that once you have started buying chocolate bars from the machine, you always have some coupons. We would like to know how many chocolate bars can be eaten if we start with N dollars and always redeem coupons if we have enough for an additional chocolate bar. For example, with 6 dollars we could consume 7 chocolate bars after purchasing 6 bars giving us 6 coupons and then redeeming the 6 coupons for one bar. This would leave us with one extra coupon. For 11 dollars, we could consume 13 chocolate bars and still have one coupon left. For 2 dollars, we could have consumed 14 chocolate bars and have two coupons left.
Write a program that inputs a value for N and outputs how many chocolate bars we can eat and how many coupons we would have left over. Use a loop that continues to redeem coupons as long as there are enough to get at least one chocolate bar.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:30
Selective incapacitation is a strategy to reduce prison population
Answers: 3
question
Computers and Technology, 22.06.2019 17:40
Write a modular program (no classes yet, just from what you learned last year), that allows two players to play a game of tic-tac-toe. use a two-dimensional char array with 3 rows and 3 columns as the game board. each element of the array should be initialized with an asterisk (*). the program should display the initial board configuration and then start a loop that does the following: allow player 1 to select a location on the board for an x by entering a row and column number. then redisplay the board with an x replacing the * in the chosen location. if there is no winner yet and the board is not yet full, allow player 2 to select a location on the board for an o by entering a row and column number. then redisplay the board with an o replacing the * in the chosen location. the loop should continue until a player has won or a tie has occurred, then display a message indicating who won, or reporting that a tie occurred. player 1 wins when there are three xs in a row, a column, or a diagonal on the game board. player 2 wins when there are three ox in a row, a column, or a diagonal on the game board. a tie occurs when all of the locations on the board are full, but there is no winner. input validation: only allow legal moves to be entered. the row must be 1, 2, or 3. the column must be 1, 2 3. the (row, column) position entered must currently be empty (i.e., still have an asterisk in it).
Answers: 1
question
Computers and Technology, 23.06.2019 02:00
Read this excerpt from helen keller’s autobiography, the story of my life. have you ever been at sea in a dense fog, when it seemed as if a tangible white darkness shut you in, and the great ship, tense and anxious, groped her way toward the shore with plummet and sounding-line, and you waited with beating heart for something to happen? i was like that ship before my education began, only i was without compass or sounding-line, and had no way of knowing how near the harbour was. "light! give me light! " was the wordless cry of my soul, and the light of love shone on me in that very hour. . the morning after my teacher came she led me into her room and gave me a doll. the little blind children at the perkins institution had sent it and laura bridgman had dressed it; but i did not know this until afterward. when i had played with it a little while, miss sullivan slowly spelled into my hand the word "d-o-l-l." i was at once interested in this finger play and tried to imitate it. when i finally succeeded in making the letters correctly i was flushed with childish pleasure and pride. running downstairs to my mother i held up my hand and made the letters for doll. i did not know that i was spelling a word or even that words existed; i was simply making my fingers go in monkey-like imitation. in the days that followed i learned to spell in this uncomprehending way a great many words, among them pin, hat, cup and a few verbs like sit, stand and walk. based on this excerpt, which words best describe helen keller?
Answers: 2
question
Computers and Technology, 24.06.2019 05:30
If you combine two cells into one, what action are you performing? a.  adding a new row or column      b.  splitting the cells      c.  removing a new row or column      d.  merging the cells
Answers: 2
You know the right answer?
Suppose we can buy a chocolate bar from the vending machine for $1 each. Inside every chocolate bar...
Questions
question
Mathematics, 10.10.2021 19:10
question
Mathematics, 10.10.2021 19:10
question
English, 10.10.2021 19:10
question
Physics, 10.10.2021 19:10
Questions on the website: 13722360