subject

1. Write a program that determines if the user can ride a rollercoaster. To ride the rollercoaster, you must be at least 42 inches tall. You must also be at least 9 years old.
The code is already written to ask the user how tall and old they are.
Write the code to determine if they can ride the rollercoaster.
If they can, print “Welcome aboard!”
If they cannot, print “Sorry, you are not eligible to ride”

import java. util. Scanner;

public class RideTheRollerCoaster
{
public static void main(String[] args)
{
Scanner input = new Scanner(System. in);

System. out. println("How tall in inches are you? " );
int height = input. nextInt();

System. out. println("How old are you? " );
int age = input. nextInt();

//Start your code here.

}
}

2. Write a program that asks the user for three strings.
Then, print out whether or not the first string concatenated to the second string is equal to the third string. Don’t worry about spaces at the beginning or ending of strings unless you want to! The code for the user to input the three strings is already written for you.
Here are a few sample program runs:
Sample Program 1:
First string? pepper
Second string? mint
Third string? peppermint
pepper + mint is equal to peppermint!
Sample Program 2:
First string? go
Second string? fish
Third string? donuts
go + fish is not equal to donuts!
import java. util. Scanner;
public class ThreeStrings
{
public static void main(String[] args)
{
Scanner input = new Scanner(System. in);

System. out. println("First String? ");
String first = input. nextLine();

System. out. println("Second String? ");
String second = input. nextLine();

System. out. println("Third String? ");
String third = input. nextLine();

//Start your code here.

}

}

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 23:30, kenken2583
Jaina and tomas are being considered as new tenants in an apartment. the landlord looks at their creditworthiness because he wants to be sure his new tenant pays the rent on time and in full. the table below summarizes the information that was on their applications. application information questions jaina tomas how many years have you had your job? 5 2 what is your monthly salary? $1,850 $2,500 how many credit cards do you have? 4 1 how much debt do you have? $13,000 $7,000 how many times were you late with payments on credit cards in the past year? 5 1 who will the landlord decide to be more creditworthy and why? tomas because the ratio of his debt to income is less. jaina because she has had her job longer, which makes her look more stable. jaina because she has more credit cards available to her. tomas because he makes more money per month.
Answers: 2
image
Computers and Technology, 23.06.2019 00:30, alex7078
Quick pl which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 1
image
Computers and Technology, 23.06.2019 06:30, scoutbuffy2512
On early television stations, what typically filled the screen from around 11pm until 6am? test dummies test patterns tests testing colors
Answers: 1
image
Computers and Technology, 23.06.2019 12:00, deflox74
What does the level 1 topic in a word outline become in powerpoint? a. first-level bullet item b. slide title c. third-level bullet item d. second-level bullet item
Answers: 1
You know the right answer?
1. Write a program that determines if the user can ride a rollercoaster. To ride the rollercoaster,...

Questions in other subjects: