1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
OverLord2011 [107]
3 years ago
5

I have been working on this python program for a hour now, and I am trying to figure out what I an doing wrong in the loop. I ha

ve attached the code and screenshot of my work. I need help to figure out how to loop the rest of the years for a calculation. The calculation has looped the same result for all years.
This is the assignment:
In 2017, the tuition for a full time student is $6,450 per semester. The tuition will be going up for the next 7 years at a rate of 3.5% per year. Write your python program using a loop that displays the projected semester tuition for the next 7 years. You should display the actual year (2018, 2019, through 2024) and the tuition amount per semester for that year.
Here is my code:
# declare global constant variables
startingTuition = 6450.00;
starting_tuitionYear = 2018;
ending_tuitionYear = 2025;
increment = 1;
rate = .035;
tuition = 0;
tuitionRate = 0;
#loop for the next 7 years
for year in range(starting_tuitionYear, ending_tuitionYear, increment):
# calculate rate per year
tuitionRate = (rate)*startingTuition;
# add rate per year to the tuition fee
tuition = startingTuition + tuitionRate;
print('Tuition for the year of ' + str(year)+ ' is ' + str(tuition));
Computers and Technology
1 answer:
Alona [7]3 years ago
7 0

Answer:

The correct loop is as follows:

for year in range(starting_tuitionYear, ending_tuitionYear, increment):

   tuition = startingTuition + rate * startingTuition

   startingTuition = tuition

   print('Tuition for the year of ' + str(year)+ ' is ' + str(tuition));

Explanation:

Required

The correction to the attached program

Some variables are not needed; so, I've removed the redundant variables.

The main error in the program is in the loop;

After the tuition for each year has been calculated, the startTuition of the next year must be set to the current tuition

<em>See attachment for complete program</em>

You might be interested in
How does a computer resolve a domain name into an ip address?
Yanka [14]

Answer:

Using the DNS service.

Explanation:

The computer sends a UDP packet with the domain name in it to port 53 of the configured DNS server, and expects a reply with the IP address of that domain.

8 0
3 years ago
Think Critically 5-1 Creating Flexible Storage.
Brrunno [24]

Answer:

The Storage Spaces feature in Windows

Explanation:

The Storage Spaces feature can be used here. This feature was initiated in Windows server 2012 and allows the user store his files on the cloud or virtual storage. This makes it possible to have a flexible storage as there is a storage pool which is updated with more storage capacity as it decreases. The feature also offers storage security, backing up files to other disks to protect against total loss of data on a failed disk.

7 0
3 years ago
What the user enters in the computer is called?
stira [4]

.I believe its D.Data.

4 0
3 years ago
If I have added new headings in my document and wanted to update my table of contents, what would I need to do to ensure the new
g100num [7]
<span>Select Update and choose Entire Table.</span>
4 0
3 years ago
Read 2 more answers
Use comparison operators to write a question that the database will understand. Which records are more than or the same as three
Semmy [17]

Answer:

>=20

Explanation:

We are required to use the comparison operators, and they are like > , <, <=, >=, !=

We need to use more than or same:

And that is >=3000

And this is the required answer.

6 0
3 years ago
Other questions:
  • What technological innovation was the key factor driving the booming economy?
    8·1 answer
  • What is the name of the mvost powerful battery
    6·1 answer
  • What is the smallest unit of data on the hard drive?
    5·1 answer
  • Whats the next lyric,i baked you a pie,pie,pie
    7·2 answers
  • Aspiring graphic designers can earn a(n) certification for graphic design software, such as Photoshop and Acrobat.
    9·2 answers
  • What is the range of values that a short can represent?
    14·1 answer
  • Help please<br>x + 1 = –x + (–5)​
    7·1 answer
  • HELP ASAP DONT ANSWER WITH A LINK​
    9·1 answer
  • HELP THIS IS SO DIFFICULT
    10·2 answers
  • Who designed the Analytical Engine in the 1830s? Alan Turing Alan Turing Charles Babbage Charles Babbage Bill Gates Bill Gates S
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!