In Java Code using modular programming ask the user to input 3 restaurant names. Find and Validate the longest name in length and then print the longest name.
import java.util.Scanner;
public class LongestRestaurantName {
public static String readRestaurantName(Scanner in) {
System.out.print("Enter restaurant name: ");
return in.nextLine();
}
public static String findLongestRestaurant(String s1, String s2, String s3) {
if (s1.length() >= s2.length() && s1.length() >= s3.length()) {
return s1;
} else if (s2.length() >= s1.length() && s2.length() >= s3.length()) {
return s2;
} else {
return s3;
}
}
public static String getLongestRestaurantName() {
Scanner in = new Scanner(System.in);
String restaurant1 = readRestaurantName(in);
String restaurant2 = readRestaurantName(in);
String restaurant3 = readRestaurantName(in);
return findLongestRestaurant(restaurant1, restaurant2, restaurant3);
}
public static void printResult(String longestRestaurant) {
System.out.println("Longest restaurant name is " + longestRestaurant);
}
public static void main(String[] args) {
printResult(getLongestRestaurantName());
}
}

In Java Code using modular programming ask the user to input 3 restaurant names. Find and...
java programming!!!
Write the code fragment that will do the following: • Ask the user how many numbers they want to enter • Declare and instantiate an array of doubles with as many elements as the number entered by the user • Write one 'for' loop to fill the array with data from the user • Write a second 'for' loop to calculate the sum of all of the numbers in the array • Print the calculated sum Note: Write...
Write a Java program to find the perimeter of rectangle and ask the user to input length and width.
Design a modular program using pseudo-code which prompts a user for their first name, followed by their last name; then displays a "Hello" salutation which concatenates their first name with their last name. Sample output (user input shown in red): Please enter your first name: John Please enter your last name: Smith Hello, John Smith! Your program must include a main module and one function; this function prompts the user for either their first name or last name, using a...
USING RAPTOR For the following Programming Challenges, use the modular approach and pseudocode to design a suitable program to solve it. Create a program that allows the user to input a list of first names into one array and last names into a parallel array. Input should be terminated when the user enters a sentinel character. The output should be a list of email addresses where the address is of the following from: first.last@mycollege.edu
Using java program, create a Username class. ask user to type username 1)username length have to >1 and <15 2)username can not include any special character (ex.!@##$}{|\....) ,but it also have to type Spanish or other foreign language 3)user can not include any empty space (ex. user name) all of three error have to print out. and if there is any error contains, have to ask user to input user name again. for example: input username: #$%he f username can't...
Write a method that asks the user to enter a list of names and ages using Gui input and splits the info into an array of String. Validate that every other string is an int and check the value to ensure it is between 21 and 65 inclusive, print a message to the standard error object if not. Return the array. Use regular expressions to split and validate. Must follow java conventions and indent. In java with good indentations please
modify this code to ask the user to enter their name five times name = input("what is your name?") for i in range(5): print(name)
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...
Question 4 (3 mark) : Write a Java program to ask the user to input an integer number from the keyboard. The output should indicate whether it is positive, zero, or negative, an even number or an odd number. REQUIREMENTS • Your code should ask user to input an integer number, then decide its sign and parity based on this input. • Your code should use if-else statement. Your code must work exactly as the specification and the output should...
Need Java help: 1. Create a Java program that accepts input String input from a user of first name. 2. Create a Java program that accepts input String input from a user of last name. 3. Concatenate the Strings in a full name variable and print to the console.