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
givi [52]
2 years ago
10

Assume you are given three variables, revenue, expenses, and profit, all of type Money (a structured type with two int fields, d

ollars and cents). Assign to profit the result of subtracting expenses from revenue. Let's make the happy assumption that revenue exceeds expenses. However you still may find that the cents part of expenses exceeds that of revenue. If that is the case you will have to "borrow" 1 from revenue dollars (i.e. subtract 1) and "give" it to revenue's cents (i.e. add 100!) in order to carry out the subtraction properly.
Computers and Technology
1 answer:
Andre45 [30]2 years ago
7 0

Answer:

if(revenue.cents - expenses.cents < 0){

profit.dollars = revenue.dollars - expenses.dollars - 1;

profit.cents = 1 - revenue.cents - expenses.cents;

}

else{

profit.dollars = revenue.dollars - expenses.dollars;

profit.cents = revenue.cents - expenses.cents;

}

Explanation:

We know that profit is given as: revenue - expenses from the question.

From the given expression above;

if(revenue.cents - expenses.cents < 0)

then profit.dollar will be revenue.dollars - expenses.dollars - 1; the 1 is to be carry over to the cent part. And the profit.cent will be 1 - revenue.cents - expenses.cents;

else the profit.dollars and the profit.cent is computed directly without needing to carry over:

profit.dollars = revenue.dollars - expenses.dollars;

profit.cents = revenue.cents - expenses.cents;

You might be interested in
Which command will display each line in the text file based on the alphabet?
SSSSS [86.1K]
On windows, it is the type command.
On linux, the cat command outputs the file.
All bytes that represent printable characters will be displayed as ASCII or even Unicode.
6 0
3 years ago
What are organization tools?
Nonamiya [84]
An app or software created to optimize your daily task performance
4 0
2 years ago
For whover needed pont
podryga [215]

Answer:

Thank you have a nice day:)

8 0
2 years ago
Read 2 more answers
This information is stored in every IP packet to make sure that the packet is eventually discarded if it cannot find the address
Andreas93 [3]

Answer:

TTL

Explanation:

TTL means time -to- live field is a counter that is designed to keep packets from circulating indefinitely in the network case forwarding tables accidentally create cycles. An IP datagram is typically initialized with a TTL of 60 or 64 and the TTL is decremented by one each time it enters a router. If the TTL reaches zero, the router will discard the packet. It is one of the components of the IP datagram

6 0
3 years ago
100+20000000 please give answer and win iPhone 11 pro​
Eddi Din [679]

Answer:

20000100

Explanation:

8 0
2 years ago
Other questions:
  • A web application starts when a client sends _______ to a server?
    13·1 answer
  • assume that you want to sort an array have 100000 elements which algorithm (insert sort algorithm or quick sort algorithm) is th
    12·1 answer
  • Cual es la herramienta de google que funciona como oficce ?
    11·1 answer
  • HIGH POINTS!!! <br>List the creation date of each gaming console to exist.​
    8·1 answer
  • When using the Common Internet File System (CIFS), which security model does not require a password to be set for the file share
    7·1 answer
  • The space where text and content is entered and positioned for onscreen reading or printing
    8·1 answer
  • Where does the turtle belong in the cladogram shown below?<br> I’LL GIVE YOU BRAINLYEST
    6·2 answers
  • Please help I’ll give brainleistt
    6·1 answer
  • a client has requested adjustments to the arrangement and placement of elements on an image. what does the client want changed?
    9·1 answer
  • What do you think that the next version of IR (IR 5.0) will bring if it was discovered in near future? (hint:- advance IR 4.0 fe
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!