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
solmaris [256]
3 years ago
12

Write a calculator program that keeps track of a subtotal like real calculators do. Start by asking the user for an initial numb

er. Inside a loop, asks the user for a mathematical operation and a second number. Do the operation with the first number on the second number. Keep track of the result as a 'subtotal' to be used as the first number when going back to the top of the loop. When the user quits, print out the final result and quit the program. See output for an example for the behavior of the program. The operations should be at least
Computers and Technology
1 answer:
Taya2010 [7]3 years ago
8 0

Answer:

num1 = float(input("Enter the first number: "))

while True:

   print("Add, Subtract, Multiply, Divide, or Quit ?")

   choice = input("Your choice is: ")

   if choice == "Quit":

       break

   num2 = float(input("Enter the second number: "))

   if choice == "Add":

       num1 += + num2

       print("The subtotal is: " + str(num1))

   elif choice == "Subtract":

       num1 -= num2

       print("The subtotal is: " + str(num1))

   elif choice == "Multiply":

       num1 *= num2

       print("The subtotal is: " + str(num1))

   elif choice == "Divide":

       num1 /= num2

       print("The subtotal is: " + str(num1))

print("The final result is: " + str(num1))

Explanation:

Ask the user for the first number

Create a while loop that iterates until specified condition occurs inside the loop

Ask the user for the operation or quitting

If the user chooses quitting, stop the loop. Otherwise, get the second number, perform the operation and print the subtotal

When the loop is done, the user enters Quit, print the final value result

You might be interested in
Given the function F (X, Y , Z)=Σm(0,1, 2 , 4 , 6)
Mnenie [13.5K]

Answer:

(1)Minterms complement = XYZ (2) Compliment of Minterms = Σm(0,1, 2 , 4 , 6) (3) (X+Y+Z) (4) Minimized SOP = Z + XY

Manterms = πM

Explanation:

Solution

Recall that:

Given the function F (X, Y , Z)=Σm(0,1, 2 , 4 , 6)

(1) Canonical Disjunctive Normal Form: In boolean algebra, the boolean function can be expressed as Canonical Disjunctive form known as minterms

In Minterm we assign 'I' to each uncomplimented variable and '0' to each complemented/complementary variable

For the given question stated we ave the following:

Minterms = XYZ, XYZ, XYZ, XYZ, XYZ.

(2) Canonical Conjunctive Normal Form: In boolean algebra, the boolean function can be expressed as Canonical Disjunctive form known as maxterms.

In Maxterms we assign '0' to each uncomplimented variable and '1' to each complemented/complementary variable

Compliment of Minterms = Σm(0,1, 2 , 4 , 6)

Maxterms = πM

Note: Kindly find an attached copy of the complete solution to this question below.

6 0
2 years ago
As it turns out, the scale of this chart is higher than all of these; it’s “exponential.” What does this imply for the difficult
Oksanka [162]

Answer:

no meme

Explanation:

[...]

8 0
3 years ago
Consider the following statements: struct supplierType { string name; int supplierID; }; struct paintType { supplierType supplie
Romashka [77]

Answer:

The answer is "supplierType"

Explanation:

Description of the code:

  • In the given program two structure is defined, that is "supplierType and paintType", in which "supplierType" structure two-variable name and "supplierID" is defined, that datatype is "String and integer".
  • In the next step, "paintType" is declared, in which "supplierType" object supplier is created, in which two string variable "color and paintID" are defined, in which "supplierType" data type is supplied.
3 0
3 years ago
What is included in a linked list node?
il63 [147K]

Answer: I a reference to the next node

III a data element

Explanation:

A linked list is simply referred to as a linear data structure, whereby the elements would not be stored at memory locations that are together in the sequence.

In simple words, we can simply say that a linked list is made up of nodes in which, every node has a data element and also a link or reference to the next node that is in the list.

Therefore, based on the explanation above, the correct option will be:

I. a reference to the next node

III a data element

7 0
3 years ago
Which type of transmission do modems use ?
horsena [70]
Asyncronous is the answer I think
6 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following is another name for cinematographers? (Select all that apply). lighting specialists production manager di
    8·1 answer
  • What effects will the different types of lighting produce on mountains?
    15·1 answer
  • Which one of the following is not possible to view in the debug logs?
    8·1 answer
  • A videogame designer would be most interested in the _____ elements of beowulf.
    12·2 answers
  • What is the purpose of a filename extension? How can you restore a file that you deleted from the hard disk?
    10·1 answer
  • If you want to present slides to fellow students or coworkers which productivity software should you use to create them A. Word
    14·2 answers
  • In rolling a die four times, what is the odds that at least one 5 would appear?
    6·1 answer
  • i have a class for computers and i need a free hardrive are there any websites that give me one for free in 3 days??​
    15·1 answer
  • Define and explain the two different methods by which a file can be compressed. Briefly describe one pro and one con for both ty
    13·1 answer
  • If your computer determines the destination address of a network packet is to a remote network.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!