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. import java.util.*; public class BabyNameComparison { public static void main(String[] args) { // Write your code here } }
Q: What is wrong in the following code? class TempClass { int i; public void TempClass(int j) { i…
A: About wrong in the given code
Q: Write a JAVA program to create an array of objects of a class student. The class should have field…
A: Java is a programming language. It contains extensive libraries (package). It can be used to create…
Q: Take a look at the class declaration below: package p1; class Test8{ int i; package p2; import…
A: Only variable l is accessible in Test9 directly by creating a reference of Test8. Reason: variable l…
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 a Rational class. Recall a rational number is a rational number, composed of two integers with…
A: #include <iostream>#include <string>#include <stdlib.h>using namespace std;class…
Q: Java program requirements: - a PesoCurrency class with an amount attribute. - Define an overloaded…
A: JAVA Program to create PesoCurrency with an amount attribute and a method to convert pesos to dollar…
Q: Based on the class defined below, write a program statement to create an object of the class Auto…
A: The objects are the instances of class These are created and memory is allocated using new operator…
Q: might not be reasonable to expect users to type long entries such as “oil change” accurately.…
A: import java.util.Scanner; public class CarCareChoice2 { public static void main(String[] args) {…
Q: A string of ( {[]}) is given and you have to check this valid parenthesis. Means if a braces is…
A: write a java program to check the valid parenthesis, create a separate class named solution, and…
Q: After the introduction of classes, in a java class, Adongo a student of the class came out with the…
A: Find the required correct code given as below and output :
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: public class Main 2- public static void main(String args[]) 3 static_out obji - new static_out();…
A: Classes and objects in java: Java is an object-oriented programming language and makes use of…
Q: Evaluate the JAVA code snippet below, then motivate why this is representative of good programming…
A: Good programming practices: The given code snippet is not an example of good programming practice…
Q: b. public class Dog ( String breed; int age, String color, void barking() { } void hungry) { } void…
A: Need to convert below shown image code snippet into complete encapsulation. Encapsulation is the…
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: import java.util.*; public class Car implements Comparable { private int m_inventory; //…
A: import java.util.*; class Car implements Comparable<Car> { private int m_inventory; //…
Q: Write a main class that implements our Parking office class below (main class for parking office…
A: I have made slight changes in Car class and the Customer class I have highlighted it in bold I have…
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: Implement the class Savings Account according to the following UML: Savings Account -annual…
A: The UML Class diagram is a graphical representation of classes, their attributes, methods,…
Q: Computer Science Is there a way to rewrite this Java code differently? package application;…
A: The other way to write the above code is by not declaring the variables as private , so in that case…
Q: This assignment is about OOP: Given Human class (Human.java) , please write a Student class…
A: The Human class contains name and age are the instance private data members. These members can only…
Q: What is the output of the following code? public class MyClass { private int num = 9; private String…
A: This is a java program. We will run the above Java program into a compiler. The output obtained will…
Q: public class CircleAndSphereWhileLoop 3 { public static final doubl MAX_RADIUS = 500.0; 14 %3D 15…
A: In this program we have to perform a mathematics calculation for Area of circle Circumference of…
Q: For the following class, write the code to create two different objects: public class Course{…
A: To create objects simply write , className objectName=new className(parameters); //constructor…
Q: COMPLETE THE JAVA CODE BELOW SEE ATTACHED PHOTO FOR THE PROBLEM AND THE OUTPUT
A: In Employee class 1. added to String method 2. added earning method calculate earning by…
Q: (Java) Make sure output match! Take a look at the following code: public class Employee extends…
A: I have defined a default constructor in the class Address that will call the parameterized…
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: Imagine a publishing company that markets both book and audiocassette versions of its work. Create a…
A: Actually, program is a executable software that runs on a computer.
Q: Given the below class: public class Dog { private String name; private double weight;…
A: 1.) Class : Dog public class Dog { private String name; private double weight; private…
Q: See ERROR in Java file 2:
A: You cannot write a method inside a method like we write inner classes So, to implement a new method,…
Q: Q1: Write a complete JAVA program that carries out the following tasks: - Declare a class Video with…
A: Declared Non-static data members as private and static data member as public
Q: Write a program that uses separate class-level methods to print a table of integers and the digits…
A: The several class-level methods are that kind of methods that does not use the class object. These…
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 second constructor as indicated. Sample output: User1: Minutes: 0, Messages: 0 User2:…
A: Program //PhonePlan.java public class PhonePlan { private int freeMinutes; private int…
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: public class Loan { private double annualInterestRate; private int numberOfYears; private double…
A: Actually, java is an object oriented programming language. It is a platform independent.
Q: consider the following code snippet: class Comp{ int g; public: Comp0{g=-1;} Comp(int y){g=y;} };…
A: Const is a keyword that which only create a read only reference i.e defines a variable or pointer…
Q: Problem 4) Suppose the following Course class is given: public class Course { private String…
A: If the evaluation of a logical expression exits even before the complete evaluation is done, it is…
Q: public class Product { class Food extends Product { class Cheese extends Food { Considering the…
A: The solution to the given problem is below.
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: What is the output of the following code? public class MyClass { static int num = 20; %3D private…
A: OOP stands for Object-Oriented Programming. In Java, OOP helps us to create DRY(don't repeat…
Q: What is the output of the following code? ( Assume each class is defined in a separate java file).…
A: According to the Question below the solution:
Q: Write a Fraction class that works with the FractionMath program above. It should use your…
A: The given FractionMath Main Program is: //FractionMath class public class FractionMath {…
Q: Explain the following Java Polymorphism code in details. class Shape { public double getArea() {…
A: Lets see the solution.
Q: JAVA Create a class called Quadratic for representing a one-variable quadratic expression of the…
A: A quadratic equation is in the form of the a×x2+b×x+c=0 Where a,b, and c are the coefficients of the…
Q: Write a program that converts a number entered in Roman numerals to a positive integer. Your program…
A: answer : CODE-- : #include<iostream> #include<iomanip> using namespace std; //class…
Q: Write a java program Take two test Strings (StrFirstName and StrLastName) as input from User and…
A: Given data is shown below: Write a java program Take two test Strings (StrFirstName and StrLastName)…
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.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- 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 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 } }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 +…
- 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…Please create a flowchart for the following program: // Import Scanner classimport java.util.Scanner; // Create a class Trianglepublic class Main{ // Method used to check given three sides form a valid triangle or not public static boolean isTriangle(double a, double b, double c) { // If sum of any two sides is greater than third side if((a+b > c) && (a+c > b) && (b+c > a)) { // Print triangle is valid System.out.println("Three sides form a valid triangle."); // Return true return true; } // If any of the above condition is false else {// Print triangle is invalidSystem.out.println("Three sides form a invalid triangle.\n"); // Return false return false; } } // Method used to compute the area of triangle public static double triArea(double a, double b, double c) { // Compute s double s = (a + b + c) / 2; // Compute the area of triangle double area = Math.sqrt(s*(s - a)*(s - b)*(s - c)); // Return the…Fix this program import java.util.Scanner; public class main { public static void WeShipItBad(String[] args) { int OVERNIGHT_CHARGE = 5; int TWO_DAY_CHARGE = 2; int ECONOMY_CHARGE = 1; Scanner console = new Scanner(System.in); // Scanner object to pass around. // Get item description. String itemDescription = getItemDescription(console); if (itemDescription.equals("")) { System.out.println("Invalid description."); } shipWeight = getShipWeight(scnr); if (shipWeight <= 0.0) { System.out.println(); System.out.println("Invalid weight."); } char shipMethod = getShipMethod(council); shipMethod = Character.toUpperCase(shipMethod); double shipCost = calculateShip(shipWeight, shipMethod); displayResults(itemDescription, shipCost, shipMethod, shipWeight); } public static void getItemDescription(Scanner console) { System.out.println("Enter item description:"); String description =…
- 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…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 " +…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)); } }import java.util.Scanner; class Program41 {//PSEUDOCODE //Write a program that prompts the user to enter a full name consisting of three names //first //middle //last // into one String variable //Then use methods of class String to: //print the number of characters in the full name, excluding spaces //print just the middle name and the number of characters in it //print the three initials of the name //print the last name in all lower case //print the full name in the usual alphabetical format (Last, First Middle) and proper case public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter full name:"); String fullName = sc.nextLine(); System.out.println("\nNumber of Charatcers in your name " + fullName + "':" + fullName.replace("","").length()); String[] subNames = fullName.split(" "); System.out.println("\nMiddle Name: " +…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…