Questions
C++ UNIX car.txt 0001|Mercury|LeSabre|2005|Brown|11000|2019-09-01 0002|Chevrolet|Aveo|2013|Blue|12000|2019-09-02 0003|Datsun|240Z|1979|Orange|13000|2019-09-03 0004|Ford|Galaxie|1964|Black|14000|2019-09-04 0005|Porsche|Boxster|2014|Green|15000|2019-09-0 #i

C++ UNIX

car.txt

0001|Mercury|LeSabre|2005|Brown|11000|2019-09-01
0002|Chevrolet|Aveo|2013|Blue|12000|2019-09-02
0003|Datsun|240Z|1979|Orange|13000|2019-09-03
0004|Ford|Galaxie|1964|Black|14000|2019-09-04
0005|Porsche|Boxster|2014|Green|15000|2019-09-0

#include <fstream>
#include <iostream>
#include <string>
#include <sstream>

using namespace std;

int main()
{
  
   const int RECORDS = 42;
   ifstream reader("car.txt");
   if(!reader) {
       cout << "Error: cannot open input file" << endl;
       return -1;
   }
   string item[RECORDS];
   int i = 0;
   while(!reader.eof()) {
       if((i+1) % 7 == 0)
           getline(reader,item[i++],'\n');
       else
           getline(reader,item[i++],'|');
   }
   i = 0;
   while(i < RECORDS) {
       cout << "(1) carID= " << item[i++] << endl;
       cout << "(2) carManufacturer= " << item[i++] << endl;
       cout << "(3) carModel= " << item[i++] << endl;
       cout << "(4) carYear= " << item[i++] << endl << endl;
       cout << "(5) carColor= " << item[i++] << endl << endl;
       cout << "(6) carPrice= " << item[i++] << endl << endl;
       cout << "(7) carInventoryDate= " << item[i++] << endl << endl;   
   }
   reader.close();
   return 0;
}

this is my code to read that text file.

and output should be

(1) carID=0001
(2) carManufacturer=Mercury
(3) carModel=LeSabre
(4) carYear=2005
(5) carColor=Brown
(6) carPrice=11000
(7) carInventoryDate=2019-09-01

and so on.

but my output is

(1) carID= 0001
(2) carManufacturer= Mercury
(3) carModel= LeSabre
(4) carYear= 2005

(5) carColor= Brown

(6) carPrice= 11000

(7) carInventoryDate= 2019-09-01

like this. I don't know why there is space between 4, 5, 6, 7

please help me to fix

Thank you

In: Computer Science

Giant Screen TV, Inc., is a Miami-based importer and distributor of 60-inch screen HDTVs for residential...

Giant Screen TV, Inc., is a Miami-based importer and distributor of 60-inch screen HDTVs for residential and commercial customers. Revenue and cost relations are as follows:

TR = $4,500Q - $0.1Q2

TC = $2,000,000 + $1500Q + $0.5Q2

  1. Calculate output, price and profit at the average cost-minimizing activity level.
  2. Calculate output, price and profit at the profit-maximizing activity level.
  3. Calculate the level of output and price that will maximize sales revenue. What is the profit associated with this activity level?
  4. Plot Giant Screen’s demand curve, marginal revenue curve, marginal cost curve, and average cost curve on the same graph (quantity on the horizontal axis). Show your graphical solutions to part A, B, and C on this graph.

In: Economics

 Explain the characteristics and fundamental differences of ‘Blue Ocean and Red Ocean’ strategies (Kim & Mauborgne,...

 Explain the characteristics and fundamental differences of ‘Blue Ocean and Red Ocean’ strategies (Kim & Mauborgne, 2005). Please elaborate more.

In: Operations Management

A company produces a product. Suppose the revenue for the sale of the product is given...

A company produces a product. Suppose the revenue for the sale of the product is given by the function R(q) below and the cost of producing the product is given by the function C(q) below where q represents how many units of the product the company produces and sells. Remembering that profit is equal to revenue - cost, find the quantity that produces the max profit this company can achieve. R(q) =550q C(q) = 5500+5q^2

In: Math

List indicators that a company may be an agent, not a principal, in a revenue transaction...

List indicators that a company may be an agent, not a principal, in a revenue transaction and explain the significance of this relationship in revenue recognition.

In: Accounting

Q4. What is the y/y revenue trend? in apple company

Q4. What is the y/y revenue trend? in apple company

In: Finance

The demand for DVDs is P = 60 – 0.05Q and the supply is P =...

The demand for DVDs is P = 60 – 0.05Q and the supply is P = 0.025Q. For each of the following scenarios calculate: i) price paid by buyers, ii) price received by sellers, iii) quantity supplied, iv) quantity demanded, v) quantity traded, vi) consumer surplus, vii) producer surplus, viii) tax revenue, ix) deadweight loss. Include a detailed and well-labeled graph with each scenario. Also include a list of which group(s) (either Consumers, Producers, or Government) are most likely to be in favor of each scenario.

            Scenario A: An unregulated market (no price ceilings, price floors, subsidies, or taxes)

            Scenario B: A market with a price ceiling of $15.

            Scenario C: A market with a price floor of $30.

            Scenario D: A market with a $15 per unit tax.

In: Economics

Brown Inc. acquired a delivery van on October 1, 2017 at a cost of $45,000. The...

Brown Inc. acquired a delivery van on October 1, 2017 at a cost of $45,000. The useful life of the van was 12 years with a residual value of $3,000. Assume that the company used straight-line method with fractional years rounded to the nearest whole month. The delivery van was traded-in with a new one as of end of the year of 2018 (December 31, 2018). The list price of the new delivery van was $56,000. The Brown Inc. accepted a trade-in allowance of $40,850 and paid the remaining amount in cash to get the new van. In recording the trade-in, which of the following is correct?(3 Points)

Accumulated depreciation of the old van is debited by $3,375

Accumulated depreciation of the old van is debited by $4,375

Accumulated depreciation of the old van is credited by $4,375

Accumulated depreciation of the old van is credited by $3,375

In: Accounting

A firm will purchase additional workers as long as worker's Select one: a. marginal revenue product...

A firm will purchase additional workers as long as worker's

Select one:

a. marginal revenue product is greater than zero

b. marginal revenue product is greater than or equal to its marginal resource cost

c. marginal revenue product equals the product price

d. marginal revenue product is less than its marginal resource cost

e. total revenue product is greater than its marginal resource cost

A firm will purchase additional workers as long as worker's

Select one:

a. marginal revenue product is greater than zero

b. marginal revenue product is greater than or equal to its marginal resource cost

c. marginal revenue product equals the product price

d. marginal revenue product is less than its marginal resource cost

e. total revenue product is greater than its marginal resource cost

A firm will purchase additional workers as long as worker's

Select one:

a. marginal revenue product is greater than zero

b. marginal revenue product is greater than or equal to its marginal resource cost

c. marginal revenue product equals the product price

d. marginal revenue product is less than its marginal resource cost

e. total revenue product is greater than its marginal resource cost

Tim's sandwiches, a leading producer of frozen sandwiches, is considering hiring more workers to keep up with expanding demand. If Tim's wishes to maximize profits, it should hire more workers as long as

Select one:

a. the additional revenue generated by each additional worker is positive.

b. the additional revenue generated by the next worker to be hired is greater than the additional cost of hiring that worker.

c. the additional revenue generated by selling one more sandwich is greater than the hourly wage of the next worker.

d. each additional worker can produce at least as many sandwiches per hour as the average of all the other workers.

If 25 workers produce a total of 2,500 widgets and 26 workers produce a total of 2,574 widgets,

Select one:

a. the marginal product of the 26th worker is 2,574

b. the marginal product of the 26th worker is 100 widgets

c. the marginal product of the 26th worker is 74 widgets

d. the marginal product of the 26th worker is 99 widgets

e. diminishing returns begins with the 26th worker

(DO NOT NEED TO PROVIDE EXPLANATION!)

In: Economics

1. Briefly discuss the boundary between expressing an opinion and defamation. 2. Discuss methods other than...

1. Briefly discuss the boundary between expressing an opinion and defamation.

2. Discuss methods other than filtering to prevent employees from inappropriate use of the Internet at work and whether the approach taken by a large company would be as successful at a small company.

3. Explain the main disadvantages of allowing employees at a given organization to create their own personal blogs to reach out to partners, customers, and other employees, and to improve their corporate image.

In: Psychology