Java | JSP | JSF Answers

Questions answered by Experts: 3 611

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Write a program that reads a person's first and last names separated by a space, assuming the first and last names are both single words. Then the program outputs last name, first name. End with newline.


Instructions

You will need to complete the following objectives as a Java Application: create a GUI interface

1. When the program starts the user needs to be asked if they want to make a new entry or to

view a previous entry

2. If the user wants to make a new entry, the first question will be how many meters they

travelled (this will then need to be converted into kilometers)

3. The second question will give the user 3 options to choose from, and each option will have a

value. The options are as follows:

a. Hatchback = 3

b. SUV = 3.5

c. Sports car = 4.

When the user has selected an option that options value needs to be multiplied by the

distance they travelled in kilometers

4. The third question will allow the user to enter a description, of where they travel to and why

did they travel there.


5. You need to make use of error handling to ensure that the user only types in items that are

asked and not anything else



Write a program that prompts the user for an integer and then prints out all coward numbers up to

that integer. For example, when the user enters 20, the program should print: 3 4 6 8 12 14 18 20.

Recall that a number is a prime number if it is not divisible by any number except 1 and itself.

Hint: Use Nested Loop to solve this problem. Outer Loop iterations must start from 3 and ideally inner

loop iterations must start from 2.

Coward Number: Number whose previous number is not divisible by any number other than 1

and number itself.

Instructions:

1. Create a program called CowardNumbers.java.

2. Create appropriate variables and assign values using a Scanner object.


Write a program that asks the user to enter three positive integer value; number, start, end and

Silicon Value, and then prints the Silicon table of the number from the starting number to the ending

number. After printing the table, our program should ask the user whether he or she wishes to perform

the operation again. If so, the loop should repeat; otherwise it should terminate.

Use a character input of y or Y to repeat, and n and N to terminate the loop. No break statement is

allowed.


NOTE: Perform input validation so that all numbers must be greater than 0 and the “start” number

should be less than “end” number.

NOTE: Silicon Number is multiplied with iteration counter as shown in the table below


:


Enter a number: 5

Enter starting value: 3

Enter ending value: 7

Enter silicon value: 9


Silicon Table:

5 * 3 * 9 = 135

5 * 4 * 18 = 360

5 * 5 * 27 = 675

5 * 6 * 36 = 1080

5 * 7 * 45 = 157

Enter a number: 6

Enter starting value: 5

Enter ending value: 6

Enter silicon value: 8




Write a program that asks the user to enter three positive integer value; number, start, end and

Silicon Value, and then prints the Silicon table of the number from the starting number to the ending

number. After printing the table, our program should ask the user whether he or she wishes to perform

the operation again. If so, the loop should repeat; otherwise it should terminate.

Use a character input of y or Y to repeat, and n and N to terminate the loop. No break statement is

allowed.


NOTE: Perform input validation so that all numbers must be greater than 0 and the “start” number

should be less than “end” number.

NOTE: Silicon Number is multiplied with iteration counter as shown in the table below.


Question-1 [10 Points]

Write a program that prompts the user for an integer and then prints out all coward numbers up to

that integer. For example, when the user enters 20, the program should print: 3 4 6 8 12 14 18 20.

Recall that a number is a prime number if it is not divisible by any number except 1 and itself.

Hint: Use Nested Loop to solve this problem. Outer Loop iterations must start from 3 and ideally inner

loop iterations must start from 2.

Coward Number: Number whose previous number is not divisible by any number other than 1

and number itself.

Instructions:

1. Create a program called CowardNumbers.java.

2. Create appropriate variables and assign values using a Scanner object.


Using the main functions. Create a program that takes in a student name, their home town and student number then print out the following message:
Sample run 1:
Java lab01_task03 Late Rehoboth 219100001
Output: "Hi Kate, your student number I 219100001 and how is Rehoboth?"

Your little brother has a math assignment to find whether the given u power of 2. If it is a power of 2 then he has to find the sum of the digit power of 2, then he has to find the next number which is a power of your help to validate his work. But you are already busy playing video games Develop a program so that your brother can validate his work by



little brother has a maths assignment to find whether the given number is a power of 2 if it is a power of 2 then he has to find the sum of digits if it is not

How to write a java program that asks user for a number and Prints out a series of squares of stars in increasing size up the number provided by the user.


LATEST TUTORIALS
APPROVED BY CLIENTS