Git Product home page Git Product logo

foodtruckproject's Introduction

Food Truck Project

Description

Users will input and rate a list of food trucks, then view the average rating and the highest-rated truck.

Maximum input is 5 food trucks, along with their food type and the rating. If the user inputs "quit" for the food truck name (or inputs 5 total), the program advances to the secondary menu.

The secondary menu consists of:

1: Display all food trucks
2: Display average rating
3: Display winning food truck
Q: Quit

Lessons Learned

  • When using IDE features to create new methods, it defaults to public static methods. I reverted to include logic code within the switch cases rather than using method calls to fulfill the requirement of only one static method (main).
  • Using an infinite loop for(;;) helped me loop through the user input section of the do-while loop.
  • Consuming an extra new line character with sc.nextLine() after catching invalid input from sc.nextDouble() prevented the next scanner call from advancing without appropriate user input.
  • Adding a delimiter .useDelimiter("\n") to the Scanner initialization helped account for String input that included spaces.
  • Getters and setters provide access to class instance variables while keeping them private.
  • As a security precaution, the getTrucks() method provides a copy of the FoodTruck[] array versus sending the static member, in order to display the food trucks.

Technologies Used

  • JavaSE-1.8
  • Eclipse IDE

Author

  • Andy Cary (@acary)

foodtruckproject's People

Contributors

acary avatar

Watchers

 avatar

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.