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]
3 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]3 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
Riodic Table
Ksenya-84 [330]

Answer:

riodic Table

A museum wants to store their valuable documents in cases that contain a gas that will protect the documents.

She should not choose one of the other gases because they are too

The museum director should choose

Explanation:

I didn't understand

8 0
3 years ago
Revenue xls en excel
igor_vitrenko [27]
Whast does this mean

5 0
3 years ago
What kind of block do you need to check whether a sprite is touching another sprite?
Mila [183]

A event block i know this im i have been in technology for 5 months

7 0
2 years ago
Effective nonverbal communication can cause tension.<br><br> True or False
agasfer [191]

Explanation:

When your nonverbal signals match up with the words you're saying, they increase trust, clarity, and rapport. When they don't, they can generate tension, mistrust, and confusion.

4 0
3 years ago
A security technician is configuring a new firewall appliance for a production environment. The firewall must support secure web
Zielflug [23.3K]

Answer:

Explanation:

Based on the information provided in the question, the best rules that the technician should add to the firewall would be the following

Permit 10.10.10.0/24 0.0.0.0 -p tcp --dport 443

Permit 10.10.10.0/24 192.168.1.15/24 -p udp --dport 53

This is because port 443 is used for "Secure webs services" while UDP port 53 is used for queries and domain name resolution. Both of which are the main configurations that the security technician needs to obtain.

8 0
3 years ago
Other questions:
  • In dt.py, you will implement a basic decision tree classifier for
    5·1 answer
  • Please helpp!! I need it quickly!
    6·1 answer
  • The main trade-off that all investors must consider is
    11·2 answers
  • When Clara accesses the programs and documents on her computer by way of icons, she is said to be employing
    15·1 answer
  • If an interest inventory reveals that you are highly interested in solitary, introverted work, what might be the best type of ca
    9·2 answers
  • What is the meaning of the term plot?<br>A. the final outcome of the story​
    8·1 answer
  • You decide to test an audio clip that you have inserted into your presentation, but before you do that you make sure that the co
    6·1 answer
  • When solving a problem in a group situation, which of the following traits should be demonstrated?
    8·1 answer
  • Explain briely what this statement mean.<br>"A byte is equivalent to a character"<br>​
    15·1 answer
  • When evaluating an AND operator, what is necessary for execution?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!