You are tasked with writing a program to process sales of a certain commodity. Its price is volatile and changes throughout the day. The input will come from the keyboard and will be in the form of number of items and unit price:36 9.50which means there was a sale of 36 units at 9.50. Your program should read in the transactions (Enter at least 10 of them). Indicate the end of the list by entering -99 0. After the data is read, display number of transactions, total units sold, average units per order, largest transaction amount, smallest transaction amount, total revenue and average revenue per order.

Answers

Answer 1
Answer:

Answer:

Here the code is  given as,

Explanation:

Code:

#include <math.h>

#include <cmath>  

#include <iostream>

using namespace std;

int main() {

int v_stop = 0,count = 0 ;

int x;

double y;

int t_count [100];

double p_item [100];

double Total_rev = 0.0;

double cost_trx[100];

double Largest_element , Smallest_element;

double unit_sold = 0.0;

for( int a = 1; a < 100 && v_stop != -99 ; a = a + 1 )

  {

     cout << "Transaction # " << a << " : " ;

     cin >> x >> y;

 

  t_count[a] = x;

  p_item [a] = y;

  cost_trx[a] = x*y;

 

  v_stop = x;

  count = count + 1;

 

  }

 

  for( int a = 1; a < count; a = a + 1 )

  {

   Total_rev = Total_rev + cost_trx[a];

   unit_sold = unit_sold + t_count[a];

  }

 

  Largest_element = cost_trx[1];

  for(int i = 2;i < count - 1; ++i)

   {

      // Change < to > if you want to find the smallest element

      if(Largest_element < cost_trx[i])

          Largest_element = cost_trx[i];

   }

Smallest_element = cost_trx[1];

  for(int i = 2;i < count - 1; ++i)

   {

      // Change < to > if you want to find the smallest element

      if(Smallest_element > cost_trx[i])

          Smallest_element = cost_trx[i];

   }

  cout << "TRANSACTION PROCESSING REPORT     " << endl;

  cout << "Transaction Processed :           " << count-1 << endl;

  cout << "Uints Sold:                       " << unit_sold << endl;

  cout << "Average Units per order:          " << unit_sold/(count - 1) << endl;

  cout << "Largest Transaction:              " << Largest_element << endl;

  cout << "Smallest Transaction:             " << Smallest_element << endl;

  cout << "Total Revenue:               $    " << Total_rev << endl;

  cout << "Average Revenue :            $    " << Total_rev/(count - 1) << endl;

   

  return 0;

 

}

Output:


Related Questions

Consider the following two code segments, which are both intended to determine the longest of the three strings "pea", "pear", and "pearl" that occur in String str. For example, if str has the value "the pear in the bowl", the code segments should both print "pear" and if str has the value "the pea and the pearl", the code segments should both print "pearl". Assume that str contains at least one instance of "pea".I.if (str.indexOf("pea") >= 0){System.out.println("pea");}else if (str.indexOf("pear") >= 0){System.out.println("pear");}else if (str.indexOf("pearl") >= 0){System.out.println("pearl");}II.if (str.indexOf("pearl") >= 0){System.out.println("pearl");}else if (str.indexOf("pear") >= 0){System.out.println("pear");}else if (str.indexOf("pea") >= 0){System.out.println("pea");}Which of the following best describes the output produced by code segment I and code segment II?Both code segment I and code segment II produce correct output for all values of str.Neither code segment I nor code segment II produce correct output for all values of str.Code segment II produces correct output for all values of str, but code segment I produces correct output only for values of str that contain "pear" but not "pearl".Code segment II produces correct output for all values of str, but code segment I produces correct output only for values of str that contain "pearl".Code segment II produces correct output for all values of str, but code segment I produces correct output only for values of str that contain "pea" but not "pear".
Who could vote in the first democracy?A. EveryoneB. CitizensC. AdultsD. Women
Language: JavaYour task is to complete the logic to manage a twenty-four-hour clock (no dates, just time) that tracksthe hours, minutes, and sections, and various operations to adjust the time. The framework for yourclock is in the Time class with the four methods you must complete.1.) advanceOneSecondâ A user calls this method to advance the clock by one second.a. When the seconds value reaches 60, it rolls over to zero.b. When the seconds roll over to zero, the minutes advance.So 00:00:59 rolls over to 00:01:00.c. When the minutes reach 60, they roll over and the hours advance.So 00:59:59 rolls over to 01:00:00.d. When the hours reach 24, they roll over to zero.So 23:59:59 rolls over to 00:00:00.2.) compareTo â The user wants to know if a second time is greater than or less than the timeobject called, assuming both are on the same date.a. Returns -1 if this Time is before otherTime.b. Returns 0 if this Time is the same as otherTime.c. Returns 1 if this Time is after otherTime.3.) add â Adds the hours, minutes, and seconds of another time (the offset) to the current timeobject. The time should ârolloverâ if it exceeds the end of a 24 hour period.4.) subtract â Subtracts the hours, minutes, and seconds of another time (the offset) fromthe current time object. The time should âroll backâ if it precedes the beginning of a 24 hourperiod.________________________________________________________________________package clock;/*** Objects of the Time class hold a time value for a* European-style 24 hour clock.* The value consists of hours, minutes and seconds.* The range of the value is 00:00:00 (midnight) to 23:59:59 (one* second before midnight).*/public class Time {private int hours;private int minutes;private int seconds;/*** Add one second to the current time.* When the seconds value reaches 60, it rolls over to zero.* When the seconds roll over to zero, the minutes advance.* So 00:00:59 rolls over to 00:01:00.* When the minutes reach 60, they roll over and the hours advance.* So 00:59:59 rolls over to 01:00:00.* When the hours reach 24, they roll over to zero.* So 23:59:59 rolls over to 00:00:00.*/public void advanceOneSecond(){}/*** Compare this time to otherTime.* Assumes that both times are in the same day.* Returns -1 if this Time is before otherTime.* Returns 0 if this Time is the same as otherTime.* Returns 1 if this Time is after otherTime.*/public int compareTo(Time otherTime){return 0;}/*** Add an offset to this Time.* Rolls over the hours, minutes and seconds fields when needed.*/public void add(Time offset){}/*** Subtract an offset from this Time.* Rolls over (under?) the hours, minutes and seconds fields when needed.*/public void subtract(Time offset){}
To return the value of the cell D8, the formula should be OFFSETA1=________.
When you move or size a control in the Form Designer, Visual Studio automatically adjusts the ________________ that specify the location and size of the control.

Write an if statement that assigns 100 to x when y is equal to 0.

Answers

Answer:

if(y==0)

{

   x=100;

}

Explanation:

The above written if statement is for assigning 100 to x when the value of y is equal to 0.To check the value of the y I have used equal operator == which returns true when the value on it's left side is equal to the value to it's right else it returns false and for assigning the value to y I have used assignment operator =.

First it will be checked that the value y is equal to 0.If the then it return true means the if statement will execute.Inside if statement 100 is assigned to x.

As sensory input ________, our ability to detect changes in input or intensity ________.

Answers

As sensory input decreases, our ability to detect changes in input or intensity increases.

Why is color theory important

Answers

The Importance of Color Theory in Painting. Color Theory was a required foundations course in the Visual Communication Design program at BYU, so all the design students took it–the interior designers, graphic designers, industrial designers, and the illustrators.
Hey, mate and thanks for letting me help you.

it helped the interior designers, graphic designers the industrial designers, and the illustrators. hope l helped have a good day.

Write code which takes a user input of a String and an integer. The code should print each letter of the String the number of times the user inputted in reverse order. I believe it's supposed to use nested loops, but I can only get it to repeat the whole word backwards x times.ex.
Input a String:
code
Input an integer:
3
eeedddoooccc

Answers

import java.util.*;

public class myClass {

public static void main(String args[]) {

Scanner scan = new Scanner(System.in);

System.out.print("Input a String: ");

String str = scan.nextLine();

System.out.print("Input an integer: ");

int num = scan.nextInt();

for(int i=str.length()-1; i>=0; i--) {

for(int j=0; j<num; j++) {

System.out.print(str.charAt(i));

}

}

}

}

What is not recyclable in a
hybrid car
hydrogen car
petrol car

Answers

There are different aspect of cars that cannot be recyclable. In petrol cars, The aspect that cannot be recycled is  used gear oil, windshield wiper solution, brake fluid, power steering fluid, etc.

This is because they are very toxic substances, as they have lead and poisonous ethylene glycol in them.

  • A lot of electric and hybrid cars often uses different kinds of lithium-ion batteries and nickel metal hydride batteries that are used and not all part are recyclable.

  • In hydrogen car, their fuel cells is not to have some measure of recyclable.  The Fuel cells has some recyclable materials but not all.

Learn more about recyclable from

brainly.com/question/376227

Following a security assessment, the Chief Information Security Officer (CISO) is reviewing the results of the assessment and evaluating potential risk treatment strategies. As part of the CISO’s evaluation, a judgment of potential impact based on the identified risk is performed. To prioritize response actions, the CISO uses past experience to take into account the exposure factor as well as the external accessibility of the weakness identified. Which of the following is the CISO performing?A. Documentation of lessons learned
B. Quantitative risk assessment
C. Qualitative assessment of risk
D. Business impact scoring
E. Threat modeling

Answers

Answer:

The correct answer to the following question is option B). Quantitative risk assessment.

Explanation:

QRA ( Quantitative Risk assessment) is the objective risk  assessment tool that is used to project threat impacts.

Quantitative Risk Assessment provides the estimate of magnitude of the consequences for each of the identified budget threats.

It set out to measure, define, provide, and predict the confidence  level of the likelihood and the occurrence of the threat impacts.