You need to write a program that analyses the savings of a child who wants to buy a bike. Your program needs to get the initial saving, the number of weeks the analysis will be done and it will report...


C code


You need to write a program that analyses the savings of a child who wants to buy a bike.<br>Your program needs to get the initial saving, the number of weeks the analysis will be done<br>and it will report the amount of savings at the end of the number of weeks entered and it<br>will also make an assessment of the savings. Your program will have two functions to<br>complete the task:<br>f.<br>double savings (int w, double initial savings):Assume that the child can<br>save 20 TL per week and the amount of savings in the current week compared to<br>the previous week is:<br>savings (w) = 1.1savings (w-1) + 20<br>Write a recursive function that computes the total amount of savings at the end of<br>week, w with the initial amount of savings given to the function. Please note that in<br>week 0, your total amount of savings is the initial_savings given to the function. And<br>In every week, you receive 1% increment of your savings because they are<br>deposited in the bank.<br>void analysis (double savings, int bike_price): This function takes the<br>amount of savings and the price of a bike, and displays the necessary message on<br>the output.<br>Savings<br>Savings>=bike_price<br>Savings< bike_price<br>Message<br>You can buy the bike!!<br>Oops! Save more money!<br>Please note that in this program, the kid cannot start with zero savings. It should have a<br>saving to start the analysis. After completing the analysis once, the program will ask the user<br>if they want to do another analysis. Valid answers are (Y/y or N/n) and if other characters<br>are entered, your program should ask them to enter again.<br>Sample Run:<br>Welcome to Bike analyser!<br>Enter your initial savings: 0<br>Sorry you cannot enter 0!<br>Enter your initial savings: 20<br>Number of weeks: 3<br>At the end of week 3, savings will be 92.82 TL<br>Enter the price of the bike: 200<br>Save more money!!<br>Do you want to try again? Y<br>Enter your initial savings: 20<br>Number of weeks: 4<br>At the end of week 4, savings will be 122.10 TL<br>Enter the price of the bike: 200<br>Save more money!!<br>Do you want to try again? M<br>Not valid input!<br>Do you want to try again? N<br>Byee!<br>Recommended Reading: Chapter 7 (p. 328-342 & & 364-372)<br>Recommended Exercises: Exercises 7.1, 7.2 and 7.5.<br>

Extracted text: You need to write a program that analyses the savings of a child who wants to buy a bike. Your program needs to get the initial saving, the number of weeks the analysis will be done and it will report the amount of savings at the end of the number of weeks entered and it will also make an assessment of the savings. Your program will have two functions to complete the task: f. double savings (int w, double initial savings):Assume that the child can save 20 TL per week and the amount of savings in the current week compared to the previous week is: savings (w) = 1.1savings (w-1) + 20 Write a recursive function that computes the total amount of savings at the end of week, w with the initial amount of savings given to the function. Please note that in week 0, your total amount of savings is the initial_savings given to the function. And In every week, you receive 1% increment of your savings because they are deposited in the bank. void analysis (double savings, int bike_price): This function takes the amount of savings and the price of a bike, and displays the necessary message on the output. Savings Savings>=bike_price Savings< bike_price message you can buy the bike!! oops! save more money! please note that in this program, the kid cannot start with zero savings. it should have a saving to start the analysis. after completing the analysis once, the program will ask the user if they want to do another analysis. valid answers are (y/y or n/n) and if other characters are entered, your program should ask them to enter again. sample run: welcome to bike analyser! enter your initial savings: 0 sorry you cannot enter 0! enter your initial savings: 20 number of weeks: 3 at the end of week 3, savings will be 92.82 tl enter the price of the bike: 200 save more money!! do you want to try again? y enter your initial savings: 20 number of weeks: 4 at the end of week 4, savings will be 122.10 tl enter the price of the bike: 200 save more money!! do you want to try again? m not valid input! do you want to try again? n byee! recommended reading: chapter 7 (p. 328-342 & & 364-372) recommended exercises: exercises 7.1, 7.2 and 7.5. bike_price="" message="" you="" can="" buy="" the="" bike!!="" oops!="" save="" more="" money!="" please="" note="" that="" in="" this="" program,="" the="" kid="" cannot="" start="" with="" zero="" savings.="" it="" should="" have="" a="" saving="" to="" start="" the="" analysis.="" after="" completing="" the="" analysis="" once,="" the="" program="" will="" ask="" the="" user="" if="" they="" want="" to="" do="" another="" analysis.="" valid="" answers="" are="" (y/y="" or="" n/n)="" and="" if="" other="" characters="" are="" entered,="" your="" program="" should="" ask="" them="" to="" enter="" again.="" sample="" run:="" welcome="" to="" bike="" analyser!="" enter="" your="" initial="" savings:="" 0="" sorry="" you="" cannot="" enter="" 0!="" enter="" your="" initial="" savings:="" 20="" number="" of="" weeks:="" 3="" at="" the="" end="" of="" week="" 3,="" savings="" will="" be="" 92.82="" tl="" enter="" the="" price="" of="" the="" bike:="" 200="" save="" more="" money!!="" do="" you="" want="" to="" try="" again?="" y="" enter="" your="" initial="" savings:="" 20="" number="" of="" weeks:="" 4="" at="" the="" end="" of="" week="" 4,="" savings="" will="" be="" 122.10="" tl="" enter="" the="" price="" of="" the="" bike:="" 200="" save="" more="" money!!="" do="" you="" want="" to="" try="" again?="" m="" not="" valid="" input!="" do="" you="" want="" to="" try="" again?="" n="" byee!="" recommended="" reading:="" chapter="" 7="" (p.="" 328-342="" &="" &="" 364-372)="" recommended="" exercises:="" exercises="" 7.1,="" 7.2="" and="">
Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here