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]
4 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]4 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
8.8 Lab: Swapping variables Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the
Scilla [17]

Answer:

Following are the program in c++ language

#include<iostream> // header file

using namespace std; // using namespace

void swapvalues(int&  userVal1, int& userVal2);// fucnction declaration

int main() // main method

{

   int x,y; // variable declaration

   cout<<"Enter the two value before swapping:\n";

   cin>>x>>y; // read the two input

  cout<<"before swapping:";

  cout<<x<<y; // display the value before swapping

   swapvalues(x, y);

   cout << "\nAfter swapping:";

   cout<<x<<y; // display the value after swapping

   return 0;

}

void swapvalues(int&  userVal1, int& userVal2) // function definition

{

   int t; // variable declaration

   t = userVal1; // assign the value userval1 to variable t

   userVal1 = userVal2; // assign the value userval2 to userval1

   userVal2 = t; // assign the value of variable t to userval2

}

Output:

Enter the two value before swapping:

3

8

before swapping:3 8

After swapping   :8 3

Explanation:

Following are the description of the program

  • Declared a variable "x" and "y" of type "int".
  • Read a input by user in x and y .
  • Display the values of variable x and y before the swapping.
  • Call the function  swapvalues() by passing the value of x and y.
  • After calling the console moved In the definition of swapvalues() Function where it interchanged the value of variable userVal1 and userVal2 by using third variable "t".
  • After interchanged the console moved to the main function and finally display the value of variable "x" and "y' after the swapping.

4 0
3 years ago
A triangle is an example of __________ .
inna [77]
 CONVEX polygon. 
An equilateral triangle is a triangle that has the same side length and same angles.

It is identified as a convex polygon because it does not have a reflex angle. 
A reflex angle is an angle that is greater than 180° but lesser than 360°. Interior angles of a triangle sum up to 180°.
7 0
3 years ago
In terms of their eligibility for legal protection, how do ideas differ from song lyrics?
4vir4ik [10]

Answer:

D

Explanation:

3 0
3 years ago
Read 2 more answers
A(n)___ is divided into rows and columns.<br> What goes in the blank?
Ber [7]
A spreadsheet consists of rows and colums
8 0
3 years ago
Student Generated Code Assignments Option 1: Write a program that will read in 3 grades from the keyboard and will print the ave
AlladinOne [14]

In python:

first_grade = float(input("Please input the first grade "))

second_grade = float(input("Please input the second grade "))

third_grade = float(input("Please input the third grade "))

print("The average of the three grades is {}".format( round((first_grade + second_grade + third_grade) / 3,2)))

5 0
3 years ago
Other questions:
  • Write a program that opens a text le called quiz.txt for reading. This le contains a single line with a student's rst name then
    15·1 answer
  • What type of memory can support quad, triple, and dual channels?
    5·1 answer
  • ________ development is the term used to describe an information system development methodology that emphasizes flexibility and
    11·1 answer
  • How does the View tab of the ribbon allow you to look at a document?
    9·1 answer
  • Passwords are usually alphanumeric and usually cannot contain spaces or ________.
    10·2 answers
  • Which os the following is NOT true about the proof of work concept?
    8·1 answer
  • Select the correct answer.
    5·1 answer
  • What is the output of the below Java program?
    11·1 answer
  • The entities on which data are collected are _____.
    10·2 answers
  • Passing an argument by ___ means that only a copy of the arguments value is passed into the parameter variable and not the addrt
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!