Java代写 | Virtual Moped Assignment

本次Java代写要求使用Eclipse完成编程,主要任务是使用JDK8完成一个模拟摩托车导航的Console控制台Java程序,完成了要求的所有内容,同时也附赠完成了extra credit的内容。

Your assignment is to create a program that allows a user to drive a virtual Moped around the virtual streets of Manhattan.

The program accepts the following commands from the user:

  • “go left”
  • “go right”
  • “straight on”
  • “back up”
  • “how we doin’?”
  • “fill ‘er up”
  • “park”
  • “go to Petite Abeille”
  • “help”

See below for details.

Driving

The user simply instructs the Moped to “go left”, “go right”, “straight on”, or “back up”, and Moped moves one block in the chosen direction.

  • The Moped always starts out its life at 10th St. and 5th Ave., facing South.
  • The program must announce the Moped’s current location and orientation (which cardinal direction it is facing), when it starts, and with every move.
  • If the user commands the Moped to “park”, then the program outputs a message indicating the Moped has been parked on the sidewalk, and quits.
  • Turning left while going forwards is a different thing from turning left while in reverse, hence your moped must keep track of its orientation.

Gas

  • The moped’s gas tank stores up to 1 gallon. It comes pre-filled.
  • Driving the moped burns 1/20th of gallon per city block.
  • If the user enters the command, “how we doin’?”, the program outputs the current level of gasoline in the tank, as a percentage.
  • If the Moped runs out of gas, the user is notified that the Moped has run out of gas and no longer drives, and the program should quit.
  • To refill the gas tank, the user simply instructs the program to “fill ‘er up”.

Homing

The Moped has a special “go to Petite Abeille” command that automatically drives the Moped from wherever it happens to be to Petite Abeille restaurant at 17th St. and 6th Ave.

  • the Moped should auto-drive itself one block at a time to the address of Petite Abeille, outputting its location with each block.

Location-based advertising

Our Moped is paid for by advertising, and should output ads when it reaches the locations of our current clients:

Help

If the user enters the command, “help”, the program should display a list of commands that the program understands.

Assumptions

Our program should follow a few key assumptions:

Geography:

  • Assume that Manhattan is just a simple 200×10 grid of numbered city streets, thus ignoring real-world irregularities in geography and street names.
  • Users must not be allowed to drive their Moped off the grid… sorry 🙁 . If a user tries to do so, you must not allow it and ask them for a valid move until one is given.

Street naming:

  • Assume that Streets are named 1st St, 2nd St, 3rd St, and so on up to 200th St.
  • Assume that Avenues are named 1st Ave, 2nd Ave, 3rd Ave, 4th Ave and so on up to 10th Ave.

Street directions:

  • Assume that Street numbers increase as you go North.
  • Assume that Avenue numbers increase as you go West.

Details

Your assignment must adhere to the following requirements:

  • include a class named Moped that encapsulates all of the attributes and methods that our moped model needs in order to perform its functions.
  • include a class named TestDrive which includes a main() method that starts up the program and facilitates the interaction between the user and the Moped.
  • adhere to the object-oriented design principles of encapsulation and abstraction; make all data fields private; provide ‘getter’ and ‘setter’ methods as needed to control the behavior of your objects.

Example session

This is an example session. User input is bold.

Thanks for jumping on the moped.  We're currently parked outside Dr. Rossinsky DDS's office at 10th St. and 5th Ave, facing South.  May I say your teeth look very clean.
What would you like to do?  At any time, say "help" for assistance.  
back up
Now at 11th St. and 5th Ave, facing South.
back up
Now at 12th St. and 5th Ave, facing South.
go left
Now at 12th St. and 4th Ave, facing East.  Did you know The Strand has 18 Miles of new, used and rare books, and has been in business since 1927? 
how we doin'?
The gas tank is currently 85% full.
go to Petite Abeille
Now at 13th St. and 4th Ave, facing North.
Now at 14th St. and 4th Ave, facing North.
Now at 15th St. and 4th Ave, facing North.
Now at 15th St. and 5th Ave, facing West.
Now at 16th St. and 5th Ave, facing West.
Now at 16th St. and 6th Ave, facing West.
Now at 17th St. and 6th Ave, facing North.  We have reached the Petite Abeille.  Enjoy your moules-frites.
go left
...etc...

Extra credit

Create two more “drunk driver” Mopeds that drive themselves around erratically one block at a time.

  • Drunk driver Mopeds must be instantiated from the same class as user-driven Mopeds. Your job is to modify the code in this class to allow for both kinds of Mopeds.
  • These robotic self-driving Mopeds should automatically follow a random path, or any path you design for them, as they move one block at a time around Manhattan.
  • Drunk driver Mopeds perform all the same behaviors as user-driven Mopeds, except they do so without human intervention.
  • Drunk driver Mopeds use gas like the user’s Moped, but they never run out of gas – they automatically fill up their gas when they are nearly out of gas.
  • Drunk driver Mopeds never crash into each other. They only crash into the user’s Moped.
  • If the user’s Moped and either of the robotic Mopeds are at the same location at the same time, they should crash into each other and the user should be notified that their Moped has crashed, is totally unusable, and the program should quit.
  • Like the human-driven moped, each drunk driver moped must announce its location and orientation after every move. All output in this version must clearly identify which Moped is at which position.

 


程序代写代做C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: [email protected]  微信:dmxyzl003


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

发表评论