Write an application that prompts the user for three first names and concatenates them in every possible two-name combination so that new parents can easily compare them to find the most pleasing baby name. Here is the starting code: import java.util.*; public class BabyNameComparison { publicstaticvoidmain(String[] args) { // Write your code here } }
Q: Write a Java class that would match a string. The class has method match with String as a return…
A: Coded using Java.
Q: Write an application that prompts the user for three first names and concatenates them in every…
A: Given: Three first names for new-born babies Objective: The aim of this program is to print all the…
Q: Implement the design of the Student class so that the following output is produced: Driver Code…
A: In the question above, we are asked to create a class such that the Driver code gives the Output…
Q: Write a program in java that will contain a class named GroceryStore for storing items in grocery…
A: public class GroceryStore{ public String name; public float price; public int quantity;…
Q: Write an java application from the code below that accepts three Strings from the user and displays…
A: First we compare two strings and then based on the output another two strings are compared
Q: Write a Java program to create menu driven calculator that performs basic arithmetic operations…
A: JAVA Program: import java.util.Scanner; public class Calculator { public static void main(String[]…
Q: Design the Library and Book class so that the expected output is generated. #Write your code here…
A: Algorithm: Start Create a class Library with a class variable books which is a list and instance…
Q: A rational number is the quotient of two integers - the numerator and denominator. The denominator…
A: A rational number is defined as the number which contains two numbers called the numerator and…
Q: The Java class called Holiday is started below. An object of class Holiday represents a holiday…
A: public class Holiday { private String name; private int day; private String month; }
Q: Write a java program that finds the maximum of two and three numbers of integers using method…
A: public class Main{ public static void main(String[] args) { int a=10, b=20, c=30;…
Q: Given the following code, the output is class Base { private int x = 5; } class Derived extends Base…
A: This is an example of inheritence.
Q: Write a Java program called ThreeWords that prompts (asks) the user to enter three words, separated…
A:
Q: Java 2 billBook -invoiceNumber: String -visitDate: String -patientName: String -paid: boolean…
A: Program structure: Class bill is created. Parameters are defined. printinvoice() method is created.…
Q: What is the output of the following code? public class MyClass { static int num = 20; private String…
A: static variables are the common shared instances among all the classes public static void main…
Q: public class Myclass{ private static int count=0; private int x; //} public Myclass(int i) {…
A: To solve the question, let us first save the programming example that you have provided into two…
Q: ANSWER IN JAVA: 3.14 (Date Class) Create a class called Date that includes three instance…
A: // Date.java public class Date { private int month; private int day; private int year;…
Q: I can't compile these two java codes: 1: public class CD { //Private variables for a CD private…
A: Question given: Rectify the given java codes and compile. Errors in your code: Both java code…
Q: Write a Java class Author with following features: Instance variables: o firstName for the…
A: The complete name is the concatenation of first name and last name and this will be printed inside…
Q: Java. Write an application that accepts a word from a user and converts it to Pig Latin. If a word…
A: CODE:- import java.util.Scanner; public class PigLatin { public static boolean isVowel(char c) {…
Q: secondly, to design, write, run and test a Java Main Class, called BankAccoun package. n this test,…
A: Project Structure:
Q: in java, Consider the code shown below. It contains a syntax error, preventing successful…
A: The final keyword in java is used to restrict the user from performing certain actions. Final…
Q: Java Question - Based on code, which answer out of the choices "A, B, C, D, E" is correct. Question…
A: The answer is given below.
Q: eSenior = 3; } Answer these questions according to the UML class schema and the code given above.…
A: [JAVA] public class FlightRules {public final static int minHostessCount = 2;public final static int…
Q: Error in my Java code! I am not getting the intended results, here are my two classes and output.…
A: import java.util.*;class XXX_Course { private String course_name; public static int count=999;…
Q: a. Write a Java statement that increments the value of count by 1. b. Write a Java statement that…
A: Please find the answer below :
Q: Write a Java program containing two classes: Dog and a driver class Kennel. The Dog class consists…
A: public class Dog { int age; String name; boolean hairLength; enum tail { LONG,…
Q: getSize() //accessor method that returns the size of the array • public double getinventoryValue()…
A: public int getSize() { return itemOnShelfList.length(); } Accessor method is used…
Q: o Page 200, Question 5.25(25%) • Modify the application you wrote in Exercise 5.24 to read an odd…
A: According to information given:- We have to modify the code to read an odd number in range of 1-19…
Q: In Java: Create a class called Date that includes three instance variables-a month (type int), a…
A: We need to write a Java code for the given scenario.
Q: Write a fully documented Java program that uses the “Purchase” class from Chapter 5 of the Savitch…
A: import java.util.*;import java.text.DecimalFormat; class Purchase{ // main method public static…
Q: Write the PrintCalendar class to displaya calendar for a specified month using the Calendar and…
A: Program: //import scanner import java.util.Scanner; //class definition public class Main { // Main…
Q: Explain the answer step-by-step . Include verbal explanation. Thank you! 4. Write two…
A: Write two constructors for the below class: the constructor for the class is given below both…
Q: In Java, I need help completing these two classes. //…
A: import java.util.Scanner; public class Student{ //declaring instance variables private String…
Q: Write a java program as shown in the following UML class diagram:(read the details below) Name…
A: The UML Diagram of class Name consists of: Data members(private): first, initial, last Constructor:…
Q: Write a java classStringCheckto do the below given checks on accepted string or strings. Each…
A: In cases with multiple questions, we are needed to solve first three.
Q: Create a Java program that plays a game of rock, paper, scissors. Your program should allow the user…
A: GameFunctions.java import java.util.Random; public class GameFunctions{private String…
Q: Java. Write an application that accepts a word from a user and converts it to Pig Latin. If a word…
A: Write an application that accepts a word from a user and converts it to Pig Latin. If a word starts…
Q: ******* In java ***** create a class , and objects for the following exercise 1- for car car…
A: Objective: This program implements the Car and Cellphone classes with specified attributes and…
Q: Write a Java statement that increments the value of count by 1. ____________________ Write…
A: As per our guidelines we are supposed to answer only one question kindly repost other question as a…
Q: Write an application that accepts a word from a user and converts it to Pig Latin. If a word starts…
A: If the word begins with a consonant, all the alphabets before the vowel is placed at the end of the…
Q: Write a java application for Limpopo’s Car Care Shop that shows a user a list of available services:…
A: Code: import java.util.*;public class MyClass { public static void main(String args[]) {…
Q: PLease help me add four Java OOP concepts iin the program. Add comment so I can identify what…
A: I give the code with the addition of all oops concept I also highlighted as well as comment the…
Q: rite Java Classes In this problem, you will create a shopping cart that will help a user keep track…
A: Write Java Classes In this problem, you will create a shopping cart that will help a user keep track…
Q: Debug this program to create the desired result attached in the picture. public class Library { //…
A: Here I have defined a static class named Book with one data member and constructor inside the class…
Q: Please make a JAVA PROGRAM of this problem (See attached photos below) Program it simple if possible…
A: FLAMES game using JavaIn this post we are going to see Java code for flames game. This is one of the…
Q: Write all the code within the main method in the TestTruck class below. Implement the following…
A: import java.lang.IllegalArgumentException; public class TestTruck { public static void…
Q: Please help me with these errors in java. Errors below public class Student { //student related…
A: Modified code: import java.util.Scanner;import java.sql.*; class Student { String studName;…
Q: Write a program using java programing language. Write a Java class (called ShowNum) that displays…
A: The given problem is to be solved in Java programming where the user will enter 2 numbers as rows…
Q: Write a program in java. The Java class called Holiday is started below. An object of class…
A: public class Holiday { //declaring variables private String name; private int day; private String…
Q: Write a JAVA program that converts a number entered in Roman numerals to decimal. Your program…
A: Actually, java is a object oriented programming language. It is a platform independent.
Write an application that prompts the user for three first names and concatenates them in every possible two-name combination so that new parents can easily compare them to find the most pleasing baby name.
Here is the starting code:
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Modify the NumbersDemo2 class to accept the values of the two integers from a user at the keyboard. public class NumbersDemo2 { // Modify the code below public static void main (String args[]) { int num1 = 4, num2 = 33; displayTwiceTheNumber(num1); displayNumberPlusFive(num1); displayNumberSquared(num1); displayTwiceTheNumber(num2); displayNumberPlusFive(num2); displayNumberSquared(num2); } public static void displayTwiceTheNumber(int n) { final int FACTOR = 2; System.out.println(n + " times " + FACTOR + " is " + (n * FACTOR)); } public static void displayNumberPlusFive(int n) { final int FACTOR = 5; System.out.println(n + " plus " + FACTOR + " is " + (n + FACTOR)); } public static void displayNumberSquared(int n) { System.out.println(n + " squared is " + (n * n)); } }Modify the NumbersDemo class to accept the values of the two integers from a user at the keyboard. public class NumbersDemo2 { // Modify the code below public static void main (String args[]) { int num1 = 4, num2 = 33; displayTwiceTheNumber(num1); displayNumberPlusFive(num1); displayNumberSquared(num1); displayTwiceTheNumber(num2); displayNumberPlusFive(num2); displayNumberSquared(num2); } public static void displayTwiceTheNumber(int n) { final int FACTOR = 2; System.out.println(n + " times " + FACTOR + " is " + (n * FACTOR)); } public static void displayNumberPlusFive(int n) { final int FACTOR = 5; System.out.println(n + " plus " + FACTOR + " is " + (n + FACTOR)); } public static void displayNumberSquared(int n) { System.out.println(n + " squared is " + (n * n)); } }preLabC.java 1 import java.util.Random; 2 import java.util.StringJoiner; 3 4 public class preLabC { 5 6- 7 8 9 10 11 12 13 ~45608192023 Y 17 23 } public static int myMethod(MathVector inputVector) { int valueAt5th Position -100000; // default value for integer System.out.println("here is the contents object, inputVector: + inputVector); // extract the value at the fifth position of the array in the object // Remember: the count starts at 0. So the 5th position has an in } System.out.println("This is the value at position 5: // return the integer value found at position 5 of the return valueAt5thPosition; of 4. + valueAt5thPosition); array.. Description A MathVector object will be passed to your method. Return the 5th element inside of that object. If you look in the file MathVector.java you'll see there is a way to extract the value of one element in the array contained inside a MathVector object: /** * Returns the element at the specified index. * * @param index the index of the…
- Write complete java code for scenario given: Consider a Java class that you could use to get an acceptable integer value from the user. An object of this class will have the attributes: Minimum accepted value Maximum accepted value • Prompt String and the following method: getValue() displays the prompt and reads a value from the user. If the value read is not within the allowed range, the method should display an error message and ask the user for a new value, repeating these actions until an acceptable value is entered. The method then returns the value read.This is the code that needs to be corrected: // This application gets a user's name and displays a greeting import java.util.Scanner; public class DebugThree3 { public static void main(String args[]) { String name; name = getName(); displayGreeting(name); } public static String getName(name) { String name; Scanner input = new Scanner(System.in); System.out.print("Enter name "); name = input.nexlLine(); return name; } public static displayGreeting(String name) { System.outprintln("Hello, " + name + "!"); } }JAVA Write an application to simulate the rolling of two dice. The application should use an object of class Random once to roll the first die and again to roll the second die. The sum of the two values should then be calculated. Each die can show an integer value from 1 to 6, so the sum of the values will vary from 2 to 12, with 7 being the most frequent sum, and 2 and 12 the least frequent.
- public class test{ private static final int MAX = 100; private int[] sco; public test(int[] sco){ this.sco = sco; } private int comAvg() throws IllegalArgumentException{ int sum = 0; for (int i = 0; i < sco.length; i++){ int sc = sco[i]; if (sc < 0 || sc > MAX){ throw new IllegalArgumentException("Score (" + sc + ") is not in the range 0-" + MAX); } sum += sco[i]; } int av = sum / sco.length; return av; } public static void main(String[] args){ test test = new test(new int[] { 50, 70, 81 }); try{ int avgSc = test.comAvg(); char letG; if (avgSc < 60) letG = 'F'; else if (avgSc < 70) letG = 'D'; else if (avgSc < 80) letG = 'C'; else if (avgSc < 90) letG = 'B'; else letG = 'A'; System.out.println("\nAVG Score is " +…import java.util.* ; public class MaxFinder { public static void main(String[] args) { //average high temperatures for Toronto according to gocanada. String temperatures = "-2 -1 4 11 18 24 27 26 21 14 7 0" ; Scanner scanner = new Scanner(temperatures) ; int hottestTemp = 0 ; int hottestMonth = 0 ; int coldestTemp = 0 ; int coldestMonth = 0 ; //-----------Start below here. To do: approximate lines of code = 14 // 0. initialize month //1. write a while loop that reads temperatures from scanner (assume you do not know how many values there will be, so use the hasNextInt() method) ; // Hint: use scanner.hasNextInt() in the loop condition // Don't forget to increment variable month //2. if this is the first month or an extreme month, update the hottestMonth,hottestTemp or coldestMonth,coldestTemp variables ; // an extreme month means the temperature for this month is > the current hottest…import java.util.Scanner; public class Shady RestRoom 2 { // Modify the code below public static void main (String args[]) { int selection; int price; String result; final int QUEEN = 1, KING = 2, SUITE = 3; final int QPRICE = 125, KPRICE = 139, SPRICE = 165; final String QSTRING = "Queen bed", KSTRING = "King bed"; SSTRING = "Suite with a king bed and pull-out couch"; INVALIDSTRING = "an invalid option"; Scanner in = new Scanner(System.in); System.out.println("\t\n\nMenu\n"); System.out.println("(" + QUEEN + ") " + QSTRING); System.out.println("(" + KING + ") " + KSTRING); System.out.println("(" + SUITE + ") " + SSTRING); System.out.print("Enter Selection (1, 2, or 3) >> "); selection = in.nextInt(); if(selection == QUEEN) { result = QSTRING; price = QPRICE; } else if(selection == KING) { result = KSTRING; price = KPRICE; } else if (selection == SUITE) { result = SSTRING; price = SPRICE; } else { result = INVALIDSTRING; price = 0; } System.out.println("You selected " + result +…
- java programming I have a Java program with a restaurant/store menu. Can you please edit my program when displaying the physical receipt? I would like the physical receipt to export a PDF file, not printing the order receipt in the console. import java.util.*; public class Restaurant2 { publicstaticvoidmain(String[] args) { // Define menu items and pricesString[] menuItems= {"Apple", "Orange", "Pear", "Banana", "Kiwi", "Strawberry", "Grape", "Watermelon", "Cantaloupe", "Mango"};double[] menuPrices= {1.99, 2.99, 3.99, 4.99, 5.99, 6.99, 7.99, 8.99, 9.99, 10.99};StringusersName; // The user's name, as entered by the user.ArrayList<String> arr = new ArrayList<>(); // Define scanner objectScanner input=new Scanner(System.in); // Welcome messageSystem.out.println("Welcome to AppleStoreRecreation, what is your name:");usersName = input.nextLine(); System.out.println("Hello, "+ usersName +", my name is Patrick nice to meet you!, May I Take Your Order?"); // Display menu items…preLabC.java 1 import java.util.Random; Y 2 import java.util.StringJoiner; 3 4 public class preLabC { 5 6- 7 8 9 10 11 12 BHHHHHHHEE 13 14 15 16 17 18 19 20 21 22 23 } public static int myMethod(MathVector inputVector){ int valueAt5thPosition -100000; // default value for integer "1 System.out.println("here is the contents object, inputVector: + inputVector); } // extract the value at the fifth position of the array in the object // Remember: the count starts at 0. So the 5th position has an index of 4. System.out.println("This is the value at position 5: // return the integer value found at position 5 of the return valueAt5thPosition; + valueAt5thPosition); array.. Description A MathVector object will be passed to your method. Return the 5th element inside of that object. If you look in the file MathVector.java you'll see there is a way to extract the value of one element in the array contained inside a MathVector object: /** *Returns the element at the specified index. * * @param…public class TwoColors 10 { public static void main(String[] args) { Scanner in = new Scanner(System.in); 11 12 13 14 System.out.print("Enter your first favorite color: "); 15 16 // Step 2: Read in the next line of input and assign • it to a String variable color1 17 // 18 19 // Step 3: Trim spaces from both end and convert the // // 20 input to all lowercase and assign it back 21 22 to the same variable 23 24 System.out.print("Enter your second favorite color: "); 25 26 // Step 4: Read in the next line of input and assign 27 // it to a String variable color2 28 29 30 // Step 5: Trim spaces from both end and convert the // // 31 input to all lowercase and assign it back 32 33 to the same variable 34 35 // Step 6: Display a message according to the following: // 36 first color 37 second color message light blue 38 red That's wonderful! light blue 39 red That's even better! That's also great! 40 otherwise 41 42