Question

In this module you learned about making loops in C++ and how to combine them with...

In this module you learned about making loops in C++ and how to combine them with the material from the first few modules to solve problems.

For this assignment, you will write a C++ program that calculates a rate increase for a gym membership. Consider the following scenario:

A gym membership, which currently charges $600 per year for membership, has announced that it will increase its membership fee by 2 percent each year for the next three years.

Write a program that uses a loop to display the projected rates for the next three years. Be sure to include comments throughout your code where appropriate.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

input code:

output:

code:

#include <bits/stdc++.h>
using namespace std;

int main()
{
/*in this code i calculate increasing gym fees rate 2% of running year
not the previous year means after 1st year 2nd year rate will calculate as
secondyear_rate= firstyear_rate + 2% of firstyear_rate
thirdyear_rate= secondyear_rate + 2% of secondyear_rate*/
  
  
/*declare array for store the value*/
double increase_rates[3],rate=600;
/*compute the next three year gym membership fees*/
for(int i=0;i<3;i++)
{
/*increase fees 2% of that year*/
increase_rates[i]=rate+rate*0.02;
/*store that new year gym fees into rate */
rate=increase_rates[i];
}
/*write a loop for print the next 3 year Gym fees*/
for(int j=0;j<3;j++)
{
/*print the output*/
cout<<"Gym membership fees after "<<(j+1);
cout<<"th year is : $"<<increase_rates[j]<<endl;
}
return 0;
}

Add a comment
Know the answer?
Add Answer to:
In this module you learned about making loops in C++ and how to combine them with...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This is for an intro to C++ class, and this module is an introduction to looping...

    This is for an intro to C++ class, and this module is an introduction to looping for C++. If you have any additional question please let me know. "For this assignment, you will write a program that calculates a rate increase for a gym membership. Consider the following scenario: A gym membership, which currently charges $600 per year for membership, has announced that it will increase its membership fee by 2 percent each year for the next three years. Write...

  • In this module, you learned about Arrays in C++ and how to implement arrays within your...

    In this module, you learned about Arrays in C++ and how to implement arrays within your C++ programs. For this assignment, you will implement your knowledge of arrays for Michigan Popcorn Company’s sales management system. Write a program that lets the Michigan Popcorn Company keep track of their sales for seven different types of popcorn they produce: plain, butter, caramel, cheese, chocolate, turtle and zebra. It should use two parallel seven-element arrays: an array of strings that holds the seven...

  • Write them in python IDLE ***** 5. Average Rainfall Write a program that uses nested loops...

    Write them in python IDLE ***** 5. Average Rainfall Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program should first ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate twelve times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month. After all iterations,...

  • Lab 5 Instructions For Lab 5, you will be writing a more complex modular program that...

    Lab 5 Instructions For Lab 5, you will be writing a more complex modular program that uses at least two arrays, and has at least one loop that accesses the data in the arrays. As long as your program satisfies the requirements listed below, you are free to design and write any type of program that you care to. You are encouraged to be creative, and pick something that has meaning for you, because you'll have more fun. Feel free...

  • In this module you learned about arrays. You also began learning about implementing arrays and how...

    In this module you learned about arrays. You also began learning about implementing arrays and how they can help organize the data in a program. The magic ball eight was created in the 50's and was produced by mattel. Eight Ball is a toy and is just a game. The magic 8 ball answers your yes/no questions. You will be creating a version of the Magic 8 Ball game. You can use whats inside the attached file to build your...

  • 5.41 exercise Visual C#:How to Program (World Population Growth) World population has grown considerably over the...

    5.41 exercise Visual C#:How to Program (World Population Growth) World population has grown considerably over the centuries. Continued growth could eventually challenge the limits of breathable air, drinkable water, arable cropland and other limited resources. There's evidence that growth has been slowing in recent years and that world population could peak sometime this century, then start to decline. For this exercise, research world population growth issues online. Be sure to investigate various viewpoints. Get estimates for the current world population...

  • C PROGRAMMING Introduction In this part, you will solve a problem described in English. Although you...

    C PROGRAMMING Introduction In this part, you will solve a problem described in English. Although you may discuss ideas with your classmates, etc., everyone must write and submit their own version of the program. Do NOT use anyone else’s code, as this will result in a zero for you and the other person! Shipping Calculator Speedy Shipping Company will ship your package based on the weight and how far you are sending the package, which can be anywhere in the...

  • Summary Write a program that demonstrates the skills you’ve learned throughout this quarter. This type of...

    Summary Write a program that demonstrates the skills you’ve learned throughout this quarter. This type of project offers only a few guidelines and requirements, allowing you to invest as much time, effort and imagination as you want.  Submit your java programs (*.java) and any other I/O (*.txt) via Canvas  You’ve worked quite hard to make it this far, so have a bit of fun with this project! Design Brief: Use Case Scenario You are hired to develop a...

  • C Programming write two functions, similar to what you see in the sample program. The first will ask the user to enter some information (I have included the type in parentheses) First Name (char[]) L...

    C Programming write two functions, similar to what you see in the sample program. The first will ask the user to enter some information (I have included the type in parentheses) First Name (char[]) Last Name (char[]) Age (int) Height in Inches (double) Weight in Pounds (double) You will use pass-by-reference to modify the values of the arguments passed in from the main(). Remember that arrays require no special notation, as they are passed by reference automatically, but the other...

  • please use python and provide run result, thank you! click on pic to make it bigger...

    please use python and provide run result, thank you! click on pic to make it bigger For this assignment you will have to investigate the use of the Python random library's random generator function, random.randrange(stop), randrange produces a random integer in the range of 0 to stop-1. You will need to import random at the top of your program. You can find this in the text or using the online resources given in the lectures A Slot Machine Simulation Understand...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT