GithubHelp home page GithubHelp logo

riya-17 / cars Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 2.0 27 KB

For the given File and given a number N, and an origin O, print N cars that have horsepower greater than the average horsepower of all the cars from origin O

Java 100.00%

cars's Introduction

Cars

Cars A dataset of Cars is provided in a file (input.txt). The file has the three fields for each car: Name, Origin, Horsepower. Given this file and given a number N, and an origin O, print N cars that have horsepower greater than the average horsepower of all the cars from origin O. Note that the average horsepower should be computed from the cars of the given origin and not the whole dataset. The path to the dataset and the values of N and O will be passed as arguments to the program on command line.

For example, in the dataset below:

Chevrolet Chevelle Malibu,130.0,US
Buick Skylark 320,165.0,US
Plymouth Satellite,150.0,US
Volkswagen 1131 Deluxe Sedan,46.0,Europe
Peugeot 504,87.0,Europe
Audi 100 LS,90.0,Europe

  • Given N=1 and O=US, the output should be:
    Buick Skylark 320,165.0,US

1

  • Given N=2 and O=US, the output should be:
    Buick Skylark 320,165.0,US
    Plymouth Satellite,150.0,US

2

  • Given N=3 and O=US, the output should be:
    Buick Skylark 320,165.0,US
    Plymouth Satellite,150.0,US

3

  • Similarly,
  • Given N=1 and O=Europe, the output should be:
    Audi 100 LS,90.0,Europe

4

  • Given N=2 and O=Europe, the output should be:
    Peugeot 504,87.0,Europe
    Audi 100 LS,90.0,Europe

5

  • Given N=3 and O=Europe, the output should be:
    Peugeot 504,87.0,Europe
    Audi 100 LS,90.0,Europe

6

Input.txt

input

Temp.txt

temp

Output.txt

output

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.