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
What is a computer briage coures​
Stella [2.4K]

what's your choices for this question

4 0
3 years ago
Does a 21.6v battery work with a 24 volt controller
Mila [183]
Yes but you will need more than one battery
3 0
3 years ago
A network technician cannot get a host to connect to the internet. running the ping command shows the apipa ip address. what is
Lunna [17]
The router will not connect to th network. This will keep it from connecting to the NEXUS
6 0
3 years ago
A software computer error, is a error produced by the malfunctioning of a computer part. E.g. RAMImmersive Reader
Andru [333]

Answer:

? is this you question true or false because i dont know the answer yet

Explanation:

4 0
3 years ago
In 1-2 sentences, describe how to use the thesaurus in the Word Processor you have used.
jasenka [17]
Thesaurus is a tool use to find the synonym of the of a word.
Here's the way to use the thesaurus in the word processor.
=> highlight the word, then right-click, Navigate to synonyms and the words will  display.
3 0
3 years ago
Read 2 more answers
Other questions:
  • When Aaron was called for an interview at a graphic designing company, his first interview test assessed his creativity and his
    7·2 answers
  • Exposing employee and customer personal data to an untrusted environment is an example of:
    9·1 answer
  • How to write "There are four parking spots on campus that may be used only by Nobel Prize winning faculty." this sentence correc
    12·1 answer
  • Yet another variation: A better packet switched network employs the concept of acknowledgment. When the end user’s device receiv
    11·1 answer
  • You want to make the background of a Web page blue, click _____.
    13·2 answers
  • How do you change your name on brainly after you have made an account​
    5·1 answer
  • Recently mobile phones have been used to pay for goods in stores and supermarkets. One method
    11·1 answer
  • Select the correct answer.
    10·1 answer
  • What are some other ways to program a robot to navigate a complicated environment other than straight paths and right angle (90
    15·1 answer
  • PLZ HELP What will be the output? class num: def init (self.a): self. number = a mul* __(self. b) return self. number + b. numbe
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!