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
Black_prince [1.1K]
3 years ago
8

Write an algorithm 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 8% interest charge on any unpaid balance below $100 , 12% interest on any unpaid balance between $100 and $500, inclusive, and 16% on any unpaid balance about $500.
Computers and Technology
1 answer:
Sindrei [870]3 years ago
6 0

Answer:

balance = float(input("Enter the current credit card balance: "))

purchases = float(input("Enter the amount of new purchases: "))

payments = float(input("Enter the amount of all payments: "))

unpaid = purchases - payments

if unpaid >= 0 and unpaid < 100:

   balance = balance + payments - purchases - (unpaid * 0.08)

elif unpaid >= 100 and unpaid <= 500:

   balance = balance + payments - purchases - (unpaid * 0.12)

else:

   balance = balance + payments - purchases - (unpaid * 0.16)

   

print("The balance is " + str(balance))

Explanation:

*The code is in Python.

Ask the user to enter the balance, amount of purchases, and amount of payments

Calculate the unpaid balance, subtract payments from purchases

Check the unpaid balance. If it is smaller than 100, calculate the new balance, add payments, subtract purchases and the 8% interest of unpaid balance. If it is between 100 and 500, calculate the new balance, add payments, subtract purchases and the 12% interest of unpaid balance. If it is greater than 500, calculate the new balance, add payments, subtract purchases and the 16% interest of unpaid balance

Print the balance

You might be interested in
g Write a program that prompts the user for an integer n between 1 and 100. If the number is outside the range, it prints an err
grin007 [14]

Answer:

The cpp program is given below.

#include<iostream>

#include<iomanip>

using namespace std;

int main() {

   

   // variables declared

   int n;

   int sum=0;

   float avg;

   

   do

   {

       // user input taken for number    

       cout<< "Enter a number between 1 and 100 (inclusive): ";

       cin>>n;

       

       if(n<1 || n>100)

           cout<<" Number is out of range. Enter valid number."<<endl;

       

   }while(n<1 || n>100);

   

   cout<<" "<<endl;

   

   // printing even numbers between num and 50  

   for(int num=1; num<=n; num++)

   {

       sum = sum + num;

   }

   

   avg = sum/n;

   

   // displaying sum and average

   cout<<"Sum of numbers between 1 and "<<n<<" is "<<sum<<endl;

   cout<<"Average of numbers between 1 and "<<n<<" is ";

   printf("%.2f", avg);

   

       return 0;

}

OUTPUT

Enter a number between 1 and 100 (inclusive): 123

Number is out of range. Enter valid number.

Enter a number between 1 and 100 (inclusive): 56

 

Sum of numbers between 1 and 56 is 1596

Average of numbers between 1 and 56 is 28.00

Explanation:

The program is explained below.

1. Two integer variables are declared to hold the number, n, and to hold the sum of numbers from 1 to n, sum. The variable sum is initialized to 0.

2. One float variable, avg, is declared to hold average of numbers from 1 to n.

3. User input is taken for n inside do-while loop. The loop executes till user enters value between 1 and 100. Otherwise, error message is printed.

4. The for loop executes over variable num, which runs from 1 to user-entered value of n.

5. Inside for loop, all the values of num are added to sum.

sum = sum + num;

6. Outside for loop, average is computed and stored in avg.

avg = sum/n;

7. The average is printed with two numbers after decimal using the following code.

printf("%.2f", avg);

8. The program ends with return statement.

9. All the code is written inside main() and no classes are involved.

3 0
3 years ago
his exercise creates a program to convert the temperature values form Fahrenheit to Celsius for a list of 10 temperature values
MissTica

Answer:

def fahrenheit_to_celsius(temperature):

   c = (temperature - 32) / 1.8

   return c    

temperature_list = [-10, -5, 0, 10, 20, 32, 40, 50, 60, 75.2]

i = 0

while i < 10:

   print(str(temperature_list[i]) + " degrees Fahrenheit = " + str(fahrenheit_to_celsius(temperature_list[i])) + " degrees Celsius")

   i += 1

Explanation:

*The code is in Python.

Create a function named fahrenheit_to_celsius that takes one parameter, temperature

Convert the temperature to celsius using the formula

Return the result of the conversion

Create a list holding ten temperatures

Create a while loop that iterates 10 times. Inside the loop, call the function to convert the each temperature in the list and print the result

5 0
3 years ago
A(n) _____ converts the programming instructions written by programmers into a language that the computer understands and proces
qaws [65]

Answer: Translator

Explanation:

each instruction written by programmer in another language must be converted (translated) to machine language in order to process, because computer understand only machine language( 0 and 1). that is translator.

8 0
3 years ago
How much memory can be addressed in protected mode?
tamaranim1 [39]
Access to 4 gigabytes of memory



5 0
3 years ago
What keyword do we use to tell Java to set aside memory to create an object?
Pavel [41]

Answer: You reserve memory locations for an array when you _____.

use the keyword new

5 0
3 years ago
Other questions:
  • A(n) ______ is a type of collaborative website that allows users to create, add, modify, or delete website content.
    12·1 answer
  • How do you change exposure to allow for greater DoF
    10·1 answer
  • Technician A says that it's a good idea to perform a test drive before attempting repairs. Technician B says that it's a good id
    9·2 answers
  • How dependent are we on technology? ​
    15·2 answers
  • Presentation software allows users to what ?
    5·2 answers
  • Victor works for a telemarketing company that is on a very tight budget. He has been tasked with finding a method for the compan
    7·2 answers
  • What makes these Pokémon special?
    9·2 answers
  • Describe the major elements and issues with system prototyping​
    7·1 answer
  • Im timed!!!!!!!!!!!!!!!!!!<br><br> I NEED HELP ASAP<br> THANK YOU SO MUCH
    7·2 answers
  • A specialized output device for producing charts, maps, and very high-quality drawings is
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!