Questions
Write a program that displays all the cars in the given file (no sorting). Each car...

Write a program that displays all the cars in the given file (no sorting). Each car property is separated by a tab character: \t

Given file:

cars.txt

make     model year
Ford   Expedition 2003
Mazda  B-Series   1989
Ford   Freestar   2003
Hyundai    Elantra    2001
Hyundai    Entourage  2008
Chevrolet  Camaro 2011
Chevrolet  Monte Carlo    2006
Chevrolet  Blazer 1996
Chevrolet  Aveo   2005
Chevrolet  Corvette   1999
Mercedes-Benz  E-Class    2006
Dodge  Avenger    1995
Pontiac    Grand Prix 1973
Mitsubishi Outlander  2011
MINI   Clubman    2011
Suzuki Aerio  2007
Dodge  Dakota Club    1992
Chevrolet  Astro  2002
Chevrolet  Tahoe  1996
Mitsubishi Mirage 1994
Porsche    944    1991
Hyundai    Elantra    1994
Mercury    Grand Marquis  1998
Volkswagen Golf   2001
Jaguar XJ Series  2005
Toyota Echo   2005
GMC    Safari 2002
GMC    Sierra 1500    2000
Chevrolet  Cobalt 2005
Jeep   Patriot    2008
Mazda  Navajo 1991
Chevrolet  Malibu 2001
Saab   900    1990
Mercury    Grand Marquis  1998
Hummer H1 2004
Subaru Loyale 1993
Jeep   Wrangler   1999
Ford   Mustang    1994
Austin Mini Cooper S  1963
Mercedes-Benz  M-Class    1998
Jeep   Wrangler   2006
Honda  Civic  1997
Plymouth   Voyager    1994
Ford   Club Wagon 1997
Audi   5000S  1984
Saturn VUE    2003
Oldsmobile Achieva    1994
Mercedes-Benz  G55 AMG    2006
Chevrolet  Express 3500   1997
Lexus  ES 1992
Cadillac   Allante    1992
Hyundai    Tiburon    1997
Pontiac    Grand Prix 1965
Ford   Focus  2000
Mitsubishi Chariot    1987
Chrysler   Prowler    2001
Land Rover Discovery  2012
Volkswagen Scirocco   1984
Ford   Bronco 1984
Hyundai    Accent 1996
Volkswagen Routan 2012
Volkswagen Golf   2003
GMC    Terrain    2010
Ford   F150   2009
GMC    Sierra 2011
Dodge  Ram Van 1500   2000
Chrysler   300    2009
Oldsmobile Achieva    1997
Land Rover Discovery  2008
Toyota 4Runner    2002
Porsche    911    1995
Toyota Land Cruiser   2002
Land Rover Defender   1994
Chevrolet  Lumina 1997
Audi   TT 2002
Chrysler   Town & Country 2009
Nissan Frontier   2000
Toyota Tercel 1997
Buick  Riviera    1997

Output needed:

Required Output

           Ford               Expedition 2003\n
          Mazda                 B-Series 1989\n
           Ford                 Freestar 2003\n
        Hyundai                  Elantra 2001\n
        Hyundai                Entourage 2008\n
      Chevrolet                   Camaro 2011\n
      Chevrolet              Monte Carlo 2006\n
      Chevrolet                   Blazer 1996\n
      Chevrolet                     Aveo 2005\n
      Chevrolet                 Corvette 1999\n
  Mercedes-Benz                  E-Class 2006\n
          Dodge                  Avenger 1995\n
        Pontiac               Grand Prix 1973\n
     Mitsubishi                Outlander 2011\n
           MINI                  Clubman 2011\n
         Suzuki                    Aerio 2007\n
          Dodge              Dakota Club 1992\n
      Chevrolet                    Astro 2002\n
      Chevrolet                    Tahoe 1996\n
     Mitsubishi                   Mirage 1994\n
        Porsche                      944 1991\n
        Hyundai                  Elantra 1994\n
        Mercury            Grand Marquis 1998\n
     Volkswagen                     Golf 2001\n
         Jaguar                XJ Series 2005\n
         Toyota                     Echo 2005\n
            GMC                   Safari 2002\n
            GMC              Sierra 1500 2000\n
      Chevrolet                   Cobalt 2005\n
           Jeep                  Patriot 2008\n
          Mazda                   Navajo 1991\n
      Chevrolet                   Malibu 2001\n
           Saab                      900 1990\n
        Mercury            Grand Marquis 1998\n
         Hummer                       H1 2004\n
         Subaru                   Loyale 1993\n
           Jeep                 Wrangler 1999\n
           Ford                  Mustang 1994\n
         Austin            Mini Cooper S 1963\n
  Mercedes-Benz                  M-Class 1998\n
           Jeep                 Wrangler 2006\n
          Honda                    Civic 1997\n
       Plymouth                  Voyager 1994\n
           Ford               Club Wagon 1997\n
           Audi                    5000S 1984\n
         Saturn                      VUE 2003\n
     Oldsmobile                  Achieva 1994\n
  Mercedes-Benz                  G55 AMG 2006\n
      Chevrolet             Express 3500 1997\n
          Lexus                       ES 1992\n
       Cadillac                  Allante 1992\n
        Hyundai                  Tiburon 1997\n
        Pontiac               Grand Prix 1965\n
           Ford                    Focus 2000\n
     Mitsubishi                  Chariot 1987\n
       Chrysler                  Prowler 2001\n
     Land Rover                Discovery 2012\n
     Volkswagen                 Scirocco 1984\n
           Ford                   Bronco 1984\n
        Hyundai                   Accent 1996\n
     Volkswagen                   Routan 2012\n
     Volkswagen                     Golf 2003\n
            GMC                  Terrain 2010\n
           Ford                     F150 2009\n
            GMC                   Sierra 2011\n
          Dodge             Ram Van 1500 2000\n
       Chrysler                      300 2009\n
     Oldsmobile                  Achieva 1997\n
     Land Rover                Discovery 2008\n
         Toyota                  4Runner 2002\n
        Porsche                      911 1995\n
         Toyota             Land Cruiser 2002\n
     Land Rover                 Defender 1994\n
      Chevrolet                   Lumina 1997\n
           Audi                       TT 2002\n
       Chrysler           Town & Country 2009\n
         Nissan                 Frontier 2000\n
         Toyota                   Tercel 1997\n
          Buick                  Riviera 1997\n

My program so far:

import java.io.*;
import java.util.Scanner;

public class PS1{

    public static void main(String[] args) {

        try{

            Scanner scnr = new Scanner(new File("cars.txt"));

            String headings = scnr.nextLine();

            String line;
            String make;
            StringBuilder model;
            String temp;

            int year=0;

            while(scnr.hasNext()){

                line = scnr.nextLine();

                Scanner scnr2 = new Scanner(line);

                make = scnr2.next();

                model = new StringBuilder(scnr2.next());

                while(scnr2.hasNext()){

                    temp = scnr2.next();

                    if(scnr2.hasNext())

                        model.append(" ").append(temp);

                    else

                        year = Integer.parseInt(temp);

                }

                System.out.printf("%15s%25s%5s\n", make, model.toString(), year);
            }

            scnr.close();

        }catch(FileNotFoundException e){

            System.out.println(e.getMessage());

        }
    }
}

My output:

Your Program's Output

           Ford               Expedition 2003\n
          Mazda                 B-Series 1989\n
           Ford                 Freestar 2003\n
        Hyundai                  Elantra 2001\n
        Hyundai                Entourage 2008\n
      Chevrolet                   Camaro 2011\n
      Chevrolet              Monte Carlo 2006\n
      Chevrolet                   Blazer 1996\n
      Chevrolet                     Aveo 2005\n
      Chevrolet                 Corvette 1999\n
  Mercedes-Benz                  E-Class 2006\n
          Dodge                  Avenger 1995\n
        Pontiac               Grand Prix 1973\n
     Mitsubishi                Outlander 2011\n
           MINI                  Clubman 2011\n
         Suzuki                    Aerio 2007\n
          Dodge              Dakota Club 1992\n
      Chevrolet                    Astro 2002\n
      Chevrolet                    Tahoe 1996\n
     Mitsubishi                   Mirage 1994\n
        Porsche                      944 1991\n
        Hyundai                  Elantra 1994\n
        Mercury            Grand Marquis 1998\n
     Volkswagen                     Golf 2001\n
         Jaguar                XJ Series 2005\n
         Toyota                     Echo 2005\n
            GMC                   Safari 2002\n
            GMC              Sierra 1500 2000\n
      Chevrolet                   Cobalt 2005\n
           Jeep                  Patriot 2008\n
          Mazda                   Navajo 1991\n
      Chevrolet                   Malibu 2001\n
           Saab                      900 1990\n
        Mercury            Grand Marquis 1998\n
         Hummer                       H1 2004\n
         Subaru                   Loyale 1993\n
           Jeep                 Wrangler 1999\n
           Ford                  Mustang 1994\n
         Austin            Mini Cooper S 1963\n
  Mercedes-Benz                  M-Class 1998\n
           Jeep                 Wrangler 2006\n
          Honda                    Civic 1997\n
       Plymouth                  Voyager 1994\n
           Ford               Club Wagon 1997\n
           Audi                    5000S 1984\n
         Saturn                      VUE 2003\n
     Oldsmobile                  Achieva 1994\n
  Mercedes-Benz                  G55 AMG 2006\n
      Chevrolet             Express 3500 1997\n
          Lexus                       ES 1992\n
       Cadillac                  Allante 1992\n
        Hyundai                  Tiburon 1997\n
        Pontiac               Grand Prix 1965\n
           Ford                    Focus 2000\n
     Mitsubishi                  Chariot 1987\n
       Chrysler                  Prowler 2001\n
           Land          Rover Discovery 2012\n
     Volkswagen                 Scirocco 1984\n
           Ford                   Bronco 1984\n
        Hyundai                   Accent 1996\n
     Volkswagen                   Routan 2012\n
     Volkswagen                     Golf 2003\n
            GMC                  Terrain 2010\n
           Ford                     F150 2009\n
            GMC                   Sierra 2011\n
          Dodge             Ram Van 1500 2000\n
       Chrysler                      300 2009\n
     Oldsmobile                  Achieva 1997\n
           Land          Rover Discovery 2008\n
         Toyota                  4Runner 2002\n
        Porsche                      911 1995\n
         Toyota             Land Cruiser 2002\n
           Land           Rover Defender 1994\n
      Chevrolet                   Lumina 1997\n
           Audi                       TT 2002\n
       Chrysler           Town & Country 2009\n
         Nissan                 Frontier 2000\n
         Toyota                   Tercel 1997\n
          Buick                  Riviera 1997\n

When mine outputs Land Rover is separated and Rover is put with the model, can someone help me fix this, thank you. Keep this in Java.

In: Computer Science

Read pages 1 – 10 in the book by Kothari, C.R., (2004) Research Methodology: Methods and...

Read pages 1 – 10 in the book by Kothari, C.R., (2004) Research Methodology: Methods and Techniques. Then answer the following three questions in your own words.

a) In your own words, write a summary of how you understand these 10 pages;
b) Explain these key concepts (short notes):
a. Research methods vs methodology
b. Research vs scientific method
c. Research approaches
d. Types of research
c) Why would you want to undertake research? (half a page)

In: Economics

(Silberberg, Problem 4.108) Ammonium nitrate, a common fertilizer, is used as an explosive in fireworks and...

(Silberberg, Problem 4.108) Ammonium nitrate, a common fertilizer, is used as an explosive in fireworks and by terrorists. In 2006, the RCMP set up a sting operation in Toronto where they arrested 18 members of an alleged terrorist cell who had ordered three metric tonnes (1 tonne = 1000 kg) of ammonium nitrate. If this quantity of ammonium nitrate decomposes explosively to nitrogen, oxygen, and water vapour, calculate the partial pressures (in atm) of each gas formed.

In: Chemistry

Given the information in the following table for three consecutive years in the U.S. economy, calculate...

Given the information in the following table for three consecutive years in the U.S. economy, calculate the missing data.




Year



Nominal GDP
(in billions of U.S. dollars)



Real GDP
(in billions of 2005 dollars)



GDP Deflator
(2005=100)



Inflation
(percent change in GDP deflator)



Real GDP per Capita (in
2005 dollars)



Population
(in millions)



2005



12,623



100.0



3.3



297.4



2006



12,959



3.2



300.3



2007



106.2



45,542



303.3

In: Economics

Assume that you just had your first child and that a relative has offered to open...

Assume that you just had your first child and that a relative has offered to open an investment account on the child’s behalf. The account promises to pay 16% interest and the relative will invest $900 between now an the child’s 18th birthday. The relative offers you two options for contributions. In option A, the relative will contribute $100 every other year on the child’s birthday beginning in year 1. In option B, the relative will contribute $260 today then $160 on the child’s 15th-18th birthdays. Which option would you choose? Calculate your answer using annual cost analysis. USING EXCEL and please show steps.

In: Finance

Relate the disclosure of the Sustainable Development Goals to the current business issue of social and...

Relate the disclosure of the Sustainable Development Goals to the current business issue of social and environmental accounting and accountability.

More info will be provided next week

Gray (2006, p82) suggests that "there is a major disconnect between the implication of global data we have reviewed [on sustainability] and the partial and localized data chosen to constitute the social, environmental and sustainability reporting.” He goes on to say that if “the global data speaks truthfully and, extrapolating, the mass of corporate activity is actually highly unsustainable, then companies need to reflect this so we can discount the empty rhetoric and turn the pressure on to governments to undertake radical reconstruction.”

Required: Explain what Gray means by the above statements. Discuss the role, if any, that accountants can play in the disclosure of corporate activity especially as it relates to the issue of sustainability.

Gray, R. 2006 “Does sustainability reporting improve corporate behavior?: Wrong question? Right time?” Accounting and Business Research, Vol. 36, Supplement 1, pp65-88.

In: Operations Management

Based on data from a​ college, scores on a certain test are normally distributed with a...

Based on data from a​ college, scores on a certain test are normally distributed with a mean of 1532 1532 and a standard deviation of 316 316. LOADING... Click the icon to view the table with standard scores and percentiles for a normal distribution. a. Find the percentage of scores greater than 1848 1848. nothing ​% ​ (Round to two decimal places as​ needed.) b. Find the percentage of scores less than 900 900. nothing ​% ​ (Round to two decimal places as​ needed.) c. Find the percentage of scores between 1374 1374 and 2006 2006. nothing ​% ​ (Round to two decimal places as​ needed.)

Standard score   Percent
-3.0   0.13
-2.5   0.62
-2   2.28
-1.5   6.68
-1   15.87
-0.9   18.41
-0.5   30.85
-0.1   46.02
0   50.00
0.10   53.98
0.5   69.15
0.9   81.59
1   84.13
1.5   93.32
2   97.72
2.5   99.38
3   99.87
3.5   99.98

In: Math

After the first three cases were culture confirmed, the management at the factory requested that workers...

After the first three cases were culture confirmed, the management at the factory requested that workers report any symptoms of illness that they might have experienced during the month of July. Of the 3155 employees, 74 reported gastrointestinal symptoms (i.e., diarrhea) in July and stool samples were obtained from these workers. Of the 74 workers who reported that they were ill, 56 were culture-confirmed. Based on retrospective interviews, the onset dates for diarrhea for these 56 workers were as follows:

Date of Onset

Number Cases

July 15

3

July 16

6

July 17

8

July 18

10

July 19

13

July 20

6

July 21

4

July 22

6

  1. What was the incidence rate for this eight day period?  
  2. List two plausible reasons why only 56 of the 74 workers who said that they had experienced gastrointestinal problems could be culture-confirmed as being infected by e coli O157:H7.

In: Civil Engineering

Mitosis and meiosis are both important processes of cell division in the life cycle of a sexual organism.

Mitosis and meiosis are both important processes of cell division in the life cycle of a sexual organism.

1. Discuss why both processes are necessary.

2. List the differences between Prophase of mitosis and Prophase I of meiosis. How do these differences contribute/ lead to genetic variation?

In: Biology

What is the difference between double helix, triple helix and quadriplex              structure in in nucleic...

What is the difference between double helix, triple helix and quadriplex              structure in in nucleic acid molecules? How are these formed? Which one is most stable and why? Can they contribute in DNA origami where you can make nano structures like cube boxes, etc.

In: Biology