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
Which of the following is NOT an algorithm?
Nina [5.8K]
I’m pretty sure it would be “A novel assigned in English class” (algorithm is a process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer.) Example: the recipe for baking a cake.
3 0
3 years ago
Have you ever used a device that relies solely on the cloud?
Morgarella [4.7K]
Yeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeesss i have
8 0
3 years ago
According to the text, the three IT trends that are having the greatest impact on the IT environment are:
maksim [4K]

Answer:

B. GRID COMPUTING , ON - DEMAND COMPUTING AND REAL TIME COMPUTING

Explanation:

Grid computing, on-demand computing and real time computing are currently the most impactful information technology processes. The Grid computing from example entails distributed computing whereby computing resources are distributed across different systems for a computing task. This is seen in server systems where a super virtual computer composed of a network of computers are connected to share resources and perform large tasks. This form of computing has majorly affected and improved complex computing tasks today.

On demand and real time computing are also other notable trends in IT with real time computing bringing the power of live and direct coverage of information to our screens and on demand making it possible for the average user to access computing resources as needed such as in the services of cloud computing providers

4 0
3 years ago
What was the first e-commerce service?
docker41 [41]

The first e-commerce service would be A)Banking. Hope this helps.

8 0
3 years ago
Dotted Decimal Notation was created to______________. Group of answer choices provide an alternative to IP addressing express ea
BaLLatris [955]

Answer:

Both b and c

Explanation:

Dotted Decimal notation is a presentation of numerical data which is expressed as decimal numbers separated by full stops. Dotted decimal notation expresses each eight bit sections of 32 bit numbers as decimal value. It provides convenient notation which is easy to understand by the people who are IT experts.

3 0
3 years ago
Other questions:
  • select three types of school which specifically emphasize learning through creativity, self expression, and play
    10·2 answers
  • You wish to enter your exam scores in a spreadsheet. Which function will help you find how each subject’s score relates to the o
    8·1 answer
  • Some drive letters, such as the letter ____ that is typically used with the primary hard drive, are usually consistent from comp
    9·1 answer
  • What is hyper transport
    10·1 answer
  • Which of the following is NOT one of the Big 3 Google Applications that we discussed?
    9·2 answers
  • Write a loop that sets newScores to oldScores shifted once left, with element 0 copied to the end. Ex: If oldScores = {10, 20, 3
    14·1 answer
  • Most presentation programs allow you to save presentations so they can be viewed online by saving them as ____
    5·2 answers
  • NAT addresses concerns over the dwindling IPv4 address space by ___________________. 1 point allowing networks to use fewer IP a
    15·1 answer
  • Explain in detail, how the Depth Wavelet Transform (DWT) algorithm works, specifically with respect to EEGs (a non-invasive brai
    11·1 answer
  • _is the joining of two or more electrical conductors by mechanically twisting the conductors together or by using a special spli
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!