e. Code a while loop that determines and prints the winnings for the Daytona 500 depending upon the position after the finish-line: 1st, 2nd, or 3rd.
the language this should be in is java
i am a bit lost on where to begin...
my b loop is
If (position == 1)
{
prizeMoney = $1,581,453;
}
else
{
if (position == 2){
prizeMoney = $1,157,470;
}
else {
if (position == 3){
prizeMoney = 857,245;
}
import java.util.Scanner; //Main class public class Main { public static void main(String[] args) { double prizeMoney; int position; Scanner scan = new Scanner(System.in); int noWinners = 3, count = 0; while (count < noWinners) { System.out.print("The driver crossed the finish line in which place?: "); position = scan.nextInt(); if (position == 1) { prizeMoney = 1_581_453; System.out.println("You’re the first place winner and you get $" + prizeMoney + "!"); } else { if (position == 2) { prizeMoney = 1_157_470; System.out.println("You’re the second place winner and you get $" + prizeMoney + "!"); } else { if (position == 3) { prizeMoney = 857_245; System.out.println("You’re the third place winner and you get $" + prizeMoney + "!"); } } } count++; } } }
OUTPUT:
FOR ANY HELP DROP A COMMENT
e. Code a while loop that determines and prints the winnings for the Daytona 500 depending...
Please code this in java: The purpose of this assignment is to: Read double data in to a TreeSet where each datum inserted is Math.abs(datum) (i.e., no negative values are inserted). NOTE: This will (i) sort the data placed into the TreeSet, and, (ii) remove duplicate values since no duplicates are allowed (i.e., duplicates will not be inserted). Create a list iterator. Iterate backwards through the TreeSet (i.e., from the largest value to the smallest) outputting all elements * -1.0....
import java.util.*; /** Description: This program determines the average of a list of (nonnegative) exam scores. Repeats for more exams until the user says to stop. Input: Numbers, sum, answer Output: Displays program description Displays instruction for user Displays average Algorithm: 1. START 2. Declare variables sum, numberOf Students, nextNumber, answer 3. Display welcome message and program description 4. DOWHILE user wants to continue 5. Display instructions on how to use the program 6. Inititalize sum and number of student...
Please help me edit my code so it looks a little different but produces the same output. Me and classmate did the assignment correctly but are afraid of plagarism. Here is my code. /** * @(#) * @author * @version 1.00 6/25/2017 3:00 PM * Program Purpose: Code a program that computes sales revenue * to-date to determine the status of the company’s * sales revenue and whether a year end bonus is in store for the employees. */ import...
In this code I have 3 racers running, dog, cat, and tigger. Dog and tigger are at random speeds and the cat controlled by pressing a and s to move. Please just edit the code to include part E which is when one of the three racers reaches the finish line announce the winner. import java.awt.Color; import java.util.Random; public class RaceTrack{ public static void main(String[] args) { // EZ.initialize(680,680); // int...
Using Swift playground and / or the command line for macOS (open Xcode, create a new Xcode project, macOS, command line tool), practice the following exercises: Exercise: Swift Variables Declare 2 variables/constants with some random values and any name of your choice Considering these 2 variables, one as a value of PI and other as a radius of circle, find the area of circle Print the area of circle Declare a string variable explicitly with value “Northeastern”. Declare a string...
Could anyone help add to my python code? I now need to calculate the mean and median. In this programming assignment you are to extend the program you wrote for Number Stats to determine the median and mode of the numbers read from the file. You are to create a program called numstat2.py that reads a series of integer numbers from a file and determines and displays the following: The name of the file. The sum of the numbers. The...
In this project, you will write a complete program that allows the user to play a game of Mastermind against the computer. A Mastermind game has the following steps: 1. The codebreaker is prompted to enter two integers: the code length n, and the range of digits m. 2. The codemaker selects a code: a random sequence of n digits, each of which is in the range [0,m-1]. 3. The codebreaker is prompted to enter a guess, an n-digit sequence....
Complete a program In C#: some code is included, you edit the areas that have not been filled. For your C# program you will complete code that plays the War card game. In this game, the deck of cards is evenly divided among two players. The players are not allowed to look at the cards in their hand. On each round of the game, both players lay down the top card from their hand. The player with the higher value...
Lab 5.1 C++ Utilizing the code from Lab 4.2, replace your Cargo class with a new base class. This will be the base for two classes created through inheritance. The Cargo class will need to have virtual functions in order to have them redefined in the child classes. You will be able to use many parts of the new Cargo class in the child classes since they will have the same arguments/parameters and the same functionality. Child class one will...