Write a Java program that can "make change." Your program should take two numbers as input, one that is a monetary amount charged and the other that is a monetary amount given. It should then return the number of each kind of bill and coin to give back as change for the difference between the amount given and the amount charged. The values assigned to the bills and coins can be based on the monetary system of any current or former government. Try to design your program so that it returns the fewest number of bills and coins as possible.
Q: Write a Java program that calculates and prints the monthly pay for an employee. The net pay is…
A: Actually, program is an executable software that runs on a computer.
Q: Write a program IN JAVA to simulate a calculator for String values. The program should take three…
A: Answer:
Q: Write a program that does the following: Accept the institution's name and its type (from the user).…
A: Program Approach: This program uses a Scanner input to get the institution's name and type from the…
Q: Write a JAVA procedural program that works out the amount a person has to pay for parking in a car…
A: The given Java program is designed by making use of user-defined methods and if-else branching…
Q: Write a program that reads a number in feet, converts it to meters, and displays the result. One…
A: Algorithm:Prompt the user to enter a value for feet.Read the input value from the user.Convert the…
Q: Write a Java Program to Check Whether a Number can be Express as Sum of Two Prime Numbers.
A: Given,Write a Java Program to Check Whether a Number can be Express as Sum of Two Prime Numbers.
Q: Time each algorithm on each test data set using the System.nanoTime() method. Calculate the average…
A: All the four answers are given below with output screenshot and explanation
Q: 1. A point in the x-y plane is represented by its x-coordinate and y-coordinate. Design the class…
A: Question given - A class description is given. Implement this class and perform all operations are…
Q: Write a java program to simulate a car insurance We have a problem, which is calculating the…
A: Here i explain it clearly. ============================================================ you want to…
Q: Write a Java program that takes input from the user for the lengths of three sides, s1, s2, and s3,…
A: The task at hand involves creating a Java program that interacts with the user to collect the…
Q: Write a complete Java program that prints out the following information: Ask the user to enter the…
A: The main objective of the java program, Rabab.java is to prompt the user to enter the last three…
Q: Write a Java program that prints a special triangle containing both numbers and letters as mentioned…
A: Note: This code should be rewritten instead of copying to the compiler otherwise it will throw a…
Q: write a java program that reads a single integer from standard input. Upon reading this single…
A: Define a Main class to encapsulate the functionality.Declare private instance variables for the…
Q: Write a Java program using at least one for loop that prints pictures of piles of counters of…
A: Given: Write a Java program using at least one for loop that prints pictures of piles of counters of…
Q: In US currency, a quarter is worth 25 cents, a dime is worth 10 cents, a nickel is worth 5 cents,…
A: The answer is given below. Algorithm: Start. Prompt the user to enter the amount. The mod of the…
Q: a program that repeatedly asks the user whether they wish to calculate another square root. If the…
A: Program: import java.util.Scanner; public class Main{ public static double sqrt(double n) {…
Q: Write a program in java in which you have take standard from a student and print if he had to give…
A: Requirements :- Write a program in java in which you have take standard from a student and print if…
Step by step
Solved in 3 steps with 1 images
- A two-dimensional random walk simulates the behavior of a particle moving in a grid of points. At each step, the random walker moves north, south, east, or west with probability equal to 1/4, independent of previous moves. Write a program RandomWalker.java that takes an int command-line argument n and simulates the motion of a random walk for n steps. Print the location at each step (including the starting point), treating the starting point as the origin (0, 0). Also, print the square of the final squared Euclidean distance from the origin as double.Computer Science Write a Java program that reads a line and a line segment and then determines whether they intersect or not. When they overlap completely, consider that as intersecting. Use variables ((lp1x, lp1y), (lp2x, lp2y)) to represent a line and ((sp1x, sp1y), (sp2x, sp2y)) to represent a line segmentIs there a way to initilize the names for students and their respective addresses? I am trying to get the Java program below to display the rollcall number with an actual name and correlating address. It would also be helpful if the names were in ascending order like the roll call numbers are. For example the programs output would look like: [rollno=1, name=Allan, address=620 pioneer st] [rollno=2, name=Chris, address=801 cheney dr] [rollno=3, name=Fedrick, address=504 plymouth ave] etc... What would that look like? Please and thank you! Source Code: import java.util.ArrayList;import java.util.Comparator;import java.util.Random;import javax.swing.JFrame;import javax.swing.JPanel;import javax.swing.JTextArea; class Student { int rollno; String name; String address; public Student(int roll, String name, String add) { super(); this.rollno = roll; this.name = name; this.address = add; } @Override public String toString() {…
- Write a Java program to calculate a gamer's total XP score with a bonus per level. The program should: 1. Prompt and read the user’s input for the gamer's name, Level 1 XP (L1), Level 2 XP (L2), Level 3 XP (L3), and Engagement score (ES). User Scanner to read input. 2. Each XP score input should be in whole numbers between 10-100 and in increments of 5. The total XP score with bonuses should be calculated as follows: L1+L1*0.20+L2+L2*0.30+L3+L3*0.50+ES+ES*0.60 3. Output the gamer's information and the total calculated XP score (including bonuses). 4. Prompt the user as to whether they want to calculate total XP for another gamer and repeat the input/output processing. 5. Allow the user to exit the program without inputting the gamer's data Documentation o Include header comments that include your name, date, and description of the program. o Include body comments. o Consistent indentations o Consistent white line spaces.I have been working on writing a java program (that goes with another I just got finished- see below CollegeCourse & Student) that prompts user to put in letter grades (A-F) for 5 different courses for a total of 10 different students. So I need to prompt user to input a student ID, then the 1st course ID, then the grade, then the 2nd course ID- then grade, the the 3rd course ID then grade, then the 4th course ID then grade, then finally the 5th course ID then grade. Then it needs to go through the same thing 10 times (for a total of 10 students). It also says the user is asked to "Enter ID for student #s" where s is an integer from 1 through 10, indicating the student (and I don't really know how to do that but I tried as I googled java); AND "Enter course ID #n, where n is an integer from 1 through 5, indicating the course number. And last it needs to verify for grade entry that only the A, B, C, D, or F are entered.I started writing notes to try to keep track of where thing are…Write a JAVA procedural program (procedural programming) that works out the amount a person has to pay for parking in a carpark in a tourist town. If they say they are disabled, they are told it is free. Otherwise they enter the numberof hours as a whole number (1-8) that they wish to park as well as whether they have an “I live locally”badge or are an old age pensioner both of which leads to a discount. The program tells them the cost to park.The calculation is done in this program as follows. If they are disabled it is free. Otherwise … Take numberof hours they wish to park and give a basic charge:• 1 hour: 3.00 pounds• 2-4 hours: 4.00 pounds• 5-6 hours: 4.50 pounds• 7-8 hours: 5.50 poundsNext modify the resulting charge based on whether they are local or not:• If local: subtract 1 pound• If OAP: subtract 2 poundsYour program MUST include methods including ones that- asks for the hours and returns the basic charge.- asks whether they live locally / are an OAP and returns the amount…
- Write a FULL Java procedural program for a simple word guessing game. Below is an example of the required program behaviour. The bold text is user keyboard input. The player is allowed to guess one letter or the whole word incorrectly up to 5 times; each incorrect guess is called a “strike”. The program starts by displaying one full stop (’.’) for each character of the secret word. You may assume the word is hardcoded into the game, is in lower case, and is of length greater than one. In each round of the game, the game first checks if the player has reached the maxinum number of strikes; if so, the player loses and the game ends. If not, the game prints an input prompt. The player then guesses either one letter (by entering a single character) or the whole word (by entering multiple characters). If a single letter is guessed correctly, meaning the character occurs in the word, the game reveals the positions of those occurrences in the word and proceeds to the next round. If the whole…Your team was asked to program a self-driving car that reaches its destination with minimum travel time. Write an algorithm for this car to choose from two possible road trips. You will calculate the travel time of each trip based on the car's current speed and the distance to the target destination. Assume that both distances and car speed are given. The programming language I'm using is Java. So, it'll be appreciated if the solution was in Java Thanks