CIS2420 presumes you already know how to perform the basic operations of some programming language Currently the college teaches Python, C++, Java, and C# at introductory levels, and it is presumed...

CIS2420 presumes you already know how to perform the basic operations of some programming language
Currently the college teaches Python, C++, Java, and C# at introductory levels, and it is presumed you can work with at least one of these
This problem will require the use of output statements, functions, mathematical operations, and selection and repetition statements to complete, but does not need arrays
These are the only basic programming constructs (plus input statements) that this course will coverThe inspiration for this problem can be found in this Dr. Barker video I came across over winter break:

https://www.youtube.com/watch?v=R86e6kQrbhk

It is a bit more mathematics than computer science, so I modified the problem slightly to accommodateSomehow you find yourself planning a golf cart road trip through the Prime Plains
These plains have been known to been a bit odd, and you know you will be able to refuel your cart along the way
You know you will start your travels at mile marker 0
You also know that your cart always uses exactly 2.125 units of fuel per mile traveled
These are highly scientific golf cart fuel measurements of course
As you pass any ODD prime number (3, 5, 7, 11, 13, 17, ...) mile marker (let's call it n), your will add n units of fuel to the cart for free
At no time between mile markers can you ever get out of the cart, for... reasons let's say
You may use C/C++, Python, C#, or Java to solve the problem with the prevously described constraints
I highly recommend using C++ even if you haven't worked too much with it in the past
This is because C++ is a low-level language most closely related to x86 assembly language
There is no need to set up an IDE for this one problem, since you can use a website like ideone.com for this if you so choose
However, I want you to sumbit your one, unzipped, plain text source code file to Blackboard when completePart 1

Your cart uses 2.125 units of fuel per mile traveled. You add n units of fuel at every odd prime number mile marker n.
What is the minimum amount of fuel needed to start with at mile 0, such that you will never get stranded in the Prime plains?Part 2

Gas pumps are famous for going drip, drip, drip. Woah oh. And if you miss one drop, it will make you stop. Woah oh oh oh.
Now that's pressure! If you started your travels with one drop of fuel less than the solution to part 1, where would you be stranded?
Here is some example output using a totally incorrect starting amount of fuel
This is just a reference to assist you in figuring out the logic of the problem
Please note that the prime number requirement is a bit different than what you might have worked with in previous coursework
LOCATION: 0 FUEL: 7.000000
2.125 FUEL BURNED
LOCATION: 1 FUEL: 4.875000
2.125 FUEL BURNED
LOCATION: 2 FUEL: 2.750000
2.125 FUEL BURNED
3 FUEL ADDED AT ODD PRIME MILE MARKER
LOCATION: 3 FUEL: 3.625000
2.125 FUEL BURNED
LOCATION: 4 FUEL: 1.500000
FINAL STRANDED LOCATION: 4.7058824
Jan 30, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here