if you post more than question, as per HomeworkLib guideliens we have to solve only first question.
Ques 1.
import java.util.*;
public class Solution
{
public static void main(String[] args)
{
// create a Scanner class object to get user input
Scanner sc = new Scanner(System.in);
System.out.print("Enter first name and last name seprated by space : ");
// read complete line using nextLine()
String name = sc.nextLine();
// split the string using split() function wuth space as delimeter
// arr[0] sores first name
// arr[1] sores last name
String[] arr = name.split(" ");
String fname = arr[0];
String lname = arr[1];
System.out.println("\nFirst Name : " + fname);
System.out.println("Last Name : " + lname);
}
}
Sample Output
1. Creatc a lava program thal asks the user to cnter his/her first name and last...
Write a Python program that asks the user to enter the number of calories and fat grams in a food item. The program should display the percentage of the calories that come from fat. One gram of fat has 9 calories, therefore: Calories from fat = fat grams * 9 The percentage of calories from fat can be calculated as follows: Calories from fat / total calories If the calories from fat are less than 30 percent of the total...
***** JAVA ONLY ***** Write a program that asks the user to enter the name of a file, and then asks the user to enter a character. The program should count and display the number of times that the specified character appears in the file. Use Notepad to create a simple file that can be used to test the program. ***** JAVA ONLY *****
Create a program that asks that asks the user for the number of males and females in a class. The program should display a percentage of males and females. For example, there are 5 males, and 15 females. That makes 20 people total. To find the percentage of males you can divide 5 by 20, which makes 0.25, or 25% HINT: USE A VARIABLE for every group of people that you will use in your calculation. Submit your .java source...
Create a Java program which asks the user how many names they want to enter. The program should then instantiate an array that will hold this many names. The main method should call a method, getNames() to allow the user to enter the names. A for loop should be used in this method. Once the names are entered, the main method should call another method displayNames() which will use a while loop to display the names entered.
In Java, write a program that asks the user for the name of a file. The program should read all the numbers from the given file and display the total and average of all numbers in the following format (three decimal digits): Total: nnnnn.nnn Average: nnnnn.nnn Class name: FileTotalAndAverage
23. Personal Weeb Page GeneratorWrite a program that asks the user for his or her name, and then asks the user to enter a sentence that describes him or herself. Here is an example of the program's screen:Enter your name: Julie Taylor [Enter]<html> <head> </head> <body> <center> <h1>Julie Taylor</h1> </center> <hr /> I am a computer science major, a member of the Jazz club, and I hope to work as a mobile app developer after I graduate. <hr /> </body> </html>Describe yourself: I am a computer science major, a member of theOnce the user has entered the requested input, the program should create an HTML file,...
Write a java program that asks the user to enter an integer. The program should then print all squares less than the number entered by the user. For example, if the user enters 120, the program should display 0, 1, 4, 9, 16, 25, 36, 49, 64, 81, and 100.
Java Q6 Part 6 Write a program with the class name BoxMaker that asks the user for an integer x (using Scanner), and then builds a box ofx asterisks. For example, if x = 4, then your output would be: // inner body " ": x - numLids ("*" on each side) == x - 2
RandomGame.cpp (2pt) Write a program that asks the user to enter his/her name. Then begin a do while loop that asks the user to enter a number between 1 and 10. Have the random number generator produce a number 1 and 10. Display the user’s name and both numbers to the screen. Compare the two numbers and report if the entered number is greater than, less than, or the same as the generated number. Ask the user if he/she’d like...
Write a program that asks the user to input the number of males and females registered in a class (Max 30 members in the class). The program should display the percentage of males and females in the class. Python programming question