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
The Linux operating system is widely used in industry, especially for servers. Why do you believe this is the case?
Anit [1.1K]

Answer:

Asking why Linux is used as a server operating system? It has many advantages

Explanation:

1. Linux has very small kernel footprints

It can be on a USB, embedded system and the like.

2. Requires very little hardware resource to run.

Building on the first point, Linux dos not need much jard ware resource to run implying it can be run on outdated CPUs, a low RAM size, small disk space and it would be possible - doesn't matter with Linux - bar the effect on performance.

3. Linux runs 80% of the Internet today

4. It's free

...... and so much more.

- Reference: Andrew Holcomb, Quorate

How Linux compares with other OS - like Windows or Mac?

May Help:

https://www.quora.com/What-are-the-advantages-of-Linux-as-a-server-operating-system

Recommendation: Jason Montoya and Glen Becker, BI Analyst, SAS Expert

6 0
3 years ago
7.2 code practice edhesive. I need help!!
GaryK [48]

Answer:

It already looks right so I don't know why it's not working but try it this way?

Explanation:

def ilovepython():

    for i in range(1, 4):

         print("I love Python")

ilovepython()

6 0
3 years ago
What are some ways to manage stress? Check all that apply.
Romashka-Z-Leto [24]
Exercise Breathe deeply Take breaks Study at night
7 0
3 years ago
Read 3 more answers
Declare a variable named
zlopas [31]

The declared variable name populationChange suitable for holding numbers like  -593142 and 8930522 is as follows:

populationChange = -593142

populationChange = 8930522

<h3>Variable:</h3>

Variable are containers use for storing values of different datatypes. Python variable can be use to store various datatype without indicating the datatype. The variable can be used to store float, string, integer etc.

For example

myVariable = 345

The variable named populationChange that holds numbers like -593142 and 8930522 can be declared as follows;

populationChange = -593142

populationChange = 8930522

Note the code is written in python

learn more on python variable here: brainly.com/question/21335728

3 0
2 years ago
_____ serves as a foundation for comparison or measurement.
sammy [17]

Answer: C

Explanation: Baseline is the starting point or used for comparison or measurement.

6 0
3 years ago
Other questions:
  • Greg works for an online games development company. He is not a net freak, but occasionally he visits online literature sites an
    7·1 answer
  • What does wireless technology use to transmit signals?
    7·1 answer
  • In your own words, what is pair-programming? What is the role of the driver? What is the role of the navigator? What are some be
    15·1 answer
  • Which of the following is a negative effect of the rise in agricultural technology following World War II?
    5·1 answer
  • POINT AND BRAINLIEIST GIVE AWAY!!!
    11·2 answers
  • Suppose that an intermixed sequence of push and pop operations are performed on a LIFO stack. The pushes push the numbers 0 thro
    14·1 answer
  • Please help it’s timed
    11·1 answer
  • From the pictures below select 5 words that best describes quality and briefly discuss it in not more than 3 sentences
    6·1 answer
  • If you play video games, please answer these questions it’s for a survey for my game development class!!
    5·1 answer
  • Select the correct answer.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!