Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design detailed algorithms for the following problems. Your algorithm must have

ID: 3811309 • Letter: D

Question

Design detailed algorithms for the following problems. Your algorithm must have at least 4 to 5 steps. And it must be very clear. Write an algorithm:

1. That gets the radius r of a circle as input. Its output is both the circumference and the area of a circle of radius r.

2. That gets as input your current credit card balance, the total dollar amount of new purchases, and the total dollar amount of all payments. The algorithm computes the new balance, which this time includes an 10% interest charge on any unpaid balance below $200, 14% interest on any unpaid balance between $200 and $500, inclusive, and 18% on any unpaid balance above $500.

3. Jason typically uses the Internet to buy various items. If the total cost of the items ordered, at one time, is $200 or more, then the shipping and handling is free; otherwise, the shipping and handling is $2 per item. Design an algorithm that prompts Jason to enter the number of items ordered and the price of each item. The algorithm then outputs the total billing amount. Your algorithm must use a loop (repetition structure) to get the price of each item. (For simplicity, you may assume that Jason orders no more than five items at a time.)

Explanation / Answer

1. Algorithm

import math
r = float(raw_input().strip());
circumpherence = 2*math.pi*r;
area = math.pi*r*r;
print "circumpherence", circumpherence
print "area" , area

2. Algorithm

cur_balance = float(raw_input().strip()); // credit card Amount to be paid
new_prchases = float(raw_input().strip());
all_payments = float(raw_input().strip());
cur_balance = cur_balance + new_prchases + all_payments //Update the credit card Amount to be paid
if(cur_balance < 200):
   cur_balance = cur_balance + cur_balance*10.0/100.0; // Add the intrest Amount
elif(cur_balance < 500 and cur_balance >= 200):
   cur_balance = cur_balance + cur_balance*14.0/100.0;  
else:
   cur_balance = cur_balance + cur_balance*18.0/100.0;  

3. Algorithm

n = int(raw_input().strip()) // input number of items
prices = zeros[n] // initialise array that saves prices
for i in range(1,n):
   print "Enter price of item", i
   price[i] = float(raw_input().strip())
total_amount = 0
for i in range(1,n):
   total_amount = total_amount + prices[i]
if(total_amount < 200):
   print "billing ammount = ", total_amount + 2*n
else:
   print "billing ammount = ", total_amount

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote