Scanner Use a command prompt to ask a user what his name is, how many lead medals did he win at the Olympic games and the mass of a medal. Tell him how much lead does he have. Don't use ...Parse... method
import java.util.*; //package of scanner class, even can use "import.java.Scanner; instead"
class ScannerDemo
{
public static void main(String args[])
{
String name;
int numberMedals;
int mass;
Scanner input=new Scanner(System.in); //Initialization of Scanner class
System.out.print("\n\nEnter a name : ");
name=input.next(); //Accepting name
System.out.print("\nHow many lead metals "+name+" did win at olympic games ? : ");
numberMedals=input.nextInt(); //Accepting number of medals
System.out.print("\nEnter a mass of a medal : ");
mass=input.nextInt(); //Accepting mass of a medal
System.out.println("");
System.out.println(name + " has "+numberMedals+" lead");
System.out.println("\n");
}
}

Scanner Use a command prompt to ask a user what his name is, how many lead...
NOTE: Use JOptionPane NOT Scanner Please Write an application that allows a user to enter the names and birthdates of up to 10 friends. Continue to prompt the user for names and birthdates until the user enters the sentinel value ZZZ for a name or has entered 10 names, whichever comes first. When the user is finished entering names, produce a count of how many names were entered, and then display the names. In a loop, continuously ask the user...
Ask the user to enter a message Ask the user how many time they want to print the message Then use "while","do-while" and "for" loop to print the message. Show the number at the beginning of the lines when printing. For example: Enter your message: Welcome to Java How many time you want to print this message: 3 Using "while" loop: 1=> Welcome to Java 2=> Welcome to Java 3=> Welcome to Java Using "do-while" loop: 1=> Welcome to Java...
Display a welcome message and then ask the user to enter his/her name Display a personal welcome message by addressing the user by his/her name. Declare a constant and assign a number to it as the Conference Room capacity. Ask the user how many people are attending the meeting. Display a meaningful message for each of the three different scenarios. The message informs the user whether he/she can have the requested room and also displays the number of people that...
Use python programing.
We will look at the idea of how many olympic medals were won by
a country compared to it's population. The 2014 population of the
medal-earning countries that participated in the Sochi winter
olymipics was 2,516,757,975 people. Further, 295 medals were won in
the winter olympics in Sochi. This means that there were:
295 / 2,516,757,975 * 10,000,000 =1.172 medals awarded for every
10,000,000 people
For each country, we can use it's population and it's medal
count...
Please write a Java program that ask the user how many beers he or she expects to consume each day, on average, as well as the average amount of money he or she spends on a single 12-ounce can of beer. Studies have shown that, on average, someone who consumes a single 12-ounce can of beer every day without compensating for the calorie intake through diet modifications or extra exercise, will gain approximately 15 pounds in one year. You can...
7. Use your class to calculate rational approximations for π using the series π=1-1+1-1+, . Your program should ask the user how many terms to include in the approximation. For full credit, use the class above as much as possible (to do all the calculations)
7. Use your class to calculate rational approximations for π using the series π=1-1+1-1+, . Your program should ask the user how many terms to include in the approximation. For full credit, use the class...
Python: Printing Student Data Ask the user: "How many students are in the class?" Read in the number of students If there are students For each student Ask for the name of the student: "Enter the name of student:" Read in the name of the student If the student's name is greater than 24 characters Do not display this student's data Do not ask for their gpa Print: "Name of student cannot exceed 24 characters." Ask for the gpa of...
How do i write the pseudocode for this java code? First, write
out pseudocode, and then create a program to help you by
accomplishing the following tasks:
: Use command line interface to ask the user to input the
following.
○ How many apples are on hand ○ How many apples should be in
stock ○ How many oranges are on hand ○ How many oranges should be
in stock
Perform an operation to determine how many of...
FIRST: Write code that prompts the user for the name of a text file, opens that file if it exists and reads the file one line at a time printing each line to the screen. You must implement the file read in a try/catch block rather than throwing the exception on the main method. NEXT: Modify your code so that the program takes the name of two files from the command line, opens the first file if it exists for...