There is a problem in the below code. Please add one line to fix it. Scanner input = new Scanner(System. in); System.out.print("Enter the number in your party: "); int number - input.nextInt(); System.out.print("Enter your full name for the reservation: "); String name = input.nextLine(); input.close();
Q: How do I remove the error from the code? public class MidtermProblems { public class Main { public…
A: Given Task: Given the java code. The task is to correct the code and produce the desired output.
Q: What is printed by the code below? Note: There are two separate classes here. public class…
A: Answer : the given code is in java here I Provide a typed code as well as the output of the code…
Q: Our system will automatically run your program several times, trying different input values to…
A: Given:
Q: Write a program to accept the length of and width of a rectangle using scanner class and display its…
A: Java has built in Scanner class which enables to accept user input. Java also supports inheritance…
Q: A method is implemented to compute a formula that involves dividing a quantity by a variable y. If…
A: For the 1st solution then it will throw an error at the very beginning of the code and thus rest of…
Q: Write a program that prompts the user to enter the numberof students and each student’s name and…
A: Program code: //Import necessary header files import java.util.*; //Declare the class name public…
Q: What is wrong with the following code? Why? How can you fix it? // Remove all the books which…
A: There is at least one error in the given code; the sentence "booksList.remove(b);" is in the wrong…
Q: What is printed by the code below? Note: There are two separate classes here. public class…
A: Answer : The above code is of Java Programming, and we need to find out the output of the given…
Q: Suppose a Scanner object is created as follows, what number? (Hint: a real number are all numbers,…
A: I have given answer below for given question.
Q: Write a Java program that implements the following classes: Show • name: String - times Watched: int…
A: A class is the fundamental unit of object oriented modelling. A class contains data and operations…
Q: can you help me to draw the flowchart for this java code : LPHTb1.java import java.util.Scanner;…
A: Dear Student, The flowchart based on your program is given below, In you program you have given…
Q: Write the JAVA method for the following a): Window to View Conversion using equations: x_v=…
A: Code: public class Temp { static void windowToView(int xwmin, int ywmin, int xwmax, int ywmax,…
Q: What is the result of running the following code (pick the single best answer)? int Answer, x[7] =…
A: I have provided a solution with justification below.
Q: Write a Java program that implements the following classes: Show name: String - timesWatched: int…
A: A class contains data (attributes) and operations (member functions) on that data in a single unit.…
Q: The method will return a string that when printed out will display a square or Bad input. If the…
A: Programming language is not mention in the question I am using python program for this question:…
Q: Write a switch statement that checks nextChoice. If 0, print "Rock". If 1, print "Paper". If 2,…
A: // Import the required the packageimport java.util.Scanner; public class Main{ public static void…
Q: U is upward, D is downward, L is left and R is right : Using the methods pickDir() and exractInt()…
A: The program is written in java. MAXLOOPS is set to 20.
Q: Write a program to extend the below program by adding an option 'g' to the menu program. If this…
A: Given: Write a program to extend the below program by adding an option 'g' to the menu program. If…
Q: write the java mini project and upload the code .class as like this and also provide the screenshot…
A: Answer: our instruction is answer the first three question form the first question.
Q: Write an expression that will cause the following code to print "Equal" if the value of…
A: Program intialized the two values traget value and sensor reading. Another value close difference is…
Q: have to use Netbeans for this program I need help because the main string is calling from test movie…
A: The given is a solution in Java which has 2 classes: Movie.java MovieTest.java The Movie class has…
Q: Write a program to accept the length of and width of a rectangle using scanner class and display its…
A: Please find the answer below
Q: I am not able to get the ID, it jumps straight to GPA, where did i mess up? This is my code :…
A: While entering the record for the student, the buffer for the input needs to be cleared. It can be…
Q: Write a program that lets the user type some text, consisting of words separated by blanks, ending…
A: //note no programming language is mentioned so i was used python programming language def…
Q: Is there a particular reason why I do not get the right answer after I choose my option? Entering…
A: The list is created to store the students and faculty objects. Loop do-while is used to take input…
Q: Write a program that will draw increasing circles like the one shoWn in the picture on the right.…
A: Here is the completed code for this problem. Comments are included, go through it, learn how things…
Q: This may make more sense if I show you a sample run of a program that implements the wizard shown…
A: You can put the case statement tp soleve the following query: switch(expression) { case x: //…
Q: Is this the correct Java programming code when repeat the images below using the text method of…
A: In the image Java code is given using swing for that you will get UI and in that, you have to put…
Q: I have this code ( C#): there is an error, as in attached, What is the problem?…
A: Given: I have this code ( C#): there is an error, as in attached, What is the problem?
Q: I need some help with this code import java.util.*; public class CarCareChoice2 { // Modify the…
A: NOTE: It is not specifically mentioned to modify the given code into what so the given code is…
Q: Write a main() program to test the book and tape class by creating instances of them, asking the…
A: Create Publication and two methods in it Create Book and two methods in it Create Tape and two…
Q: Write the code for the timeTick method in ClockDisplay that displays hours, minutes, and seconds, or…
A: here have to determine about displays hours, minutes, and seconds.
Q: Define a method printFeetInchShort, with int parameters numFeet and numInches, that prints using '…
A: A Java program for the given criteria is as follows, File name: “HeightPrinter.java” //Import…
Q: How do I check the case when the user enters an index that is negative, or lastindex > firstindex…
A: import java.util.Scanner; public class Grades { public static int sum(int[] arr) { int…
Q: What is the algorithm for the following program? public static void main(String[] args) {…
A: Explanation: - The program is all about taking input and performing the calculations. The object…
Q: I need to format the date and time to read out month first then the day then the year but it is not…
A: explanation: you can use the simple date format like this: SimpleDateFormat sdf = new…
Q: Input a number n and print out n lines of text in the pattern below, shown for example n = 5 * * *…
A: using for loops and if-else statements we can solve this problem.
Q: Create a main() method in your Sqaure class, which should contain the following code: Rectangle r =…
A: /** Rectangle class, phase 5*/ public class Rectangle { private double length; private double…
Q: will output the weekday string (which is Thursday) on the console for March 14, 2019).
A: solution is given below in code snippet
Q: Write a second convertToInches() with two double parameters, numFeet and numInches, that returns the…
A: Note: The function added in the code is along with the comments to have a better understanding of…
Q: I have the code for this one but I do seem to be missing something. This is the question - Modify…
A: Explanation: You are program logic is correct. You need to set a variable to count number of…
Q: Exercise 8 -HiLo a) In the Hi-Lo game, the player begins with a score of 1000. The player is…
A: The solution the the above problem has been given in Java in the steps below.
Q: The Java code given below implements the method named showTwos that shows the factors of 2 in a…
A: Please find the answer below :
Q: Given the enum below, write Kotlin code that will either output "Primary Color", or "Secondary…
A: Algorithm: Create a main function Prompt to input color from the user Check if the input color is…
Q: Trace the evaluation of the expressions and give the resulting values. (Make sure to give a value of…
A: =>Precedence of Operator: When there are Two or More operators in an algebraic expression the…
Q: What is wrong in the following code? How it can be fixed without changing the visibility modifiers?…
A: Given Code : Error 1 : in line 4 a.x cannot be accessed because x is a private member of class A.…
Q: A description of the GetNumberOfConsoleInputEvents method would be helpful,
A: Introduction: The GetNumberOfConsoleInputEvents function finds the total number of unread input…
Q: What should I edit or do in my code so that I will get the outcome? What could be edited in my code…
A: I have implemented the question as per given specifications. The final code is as follows: import…
Q: Use your imagination to come up with a situation where you can write a program that contains two…
A: break statement is useful in exiting the loop before reaching the last iteration For example, you…
(Intro to Java)
2.
Pls help
Thanks
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- can you solve this please? Adopt appropriate Java animation code to implement the video in the file “test4.wmv” and given that the parametric equation for a circle. x=r*cos(t) y=r*sin(t) with t in range [0, 2p] and r is the radius of the circle. (the circle goes in a loop like in the images, i did my best to try to explain it , please try to do it ) and here is a sample of what they want me to use : package javaapplication1;import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.awt.geom.*;import java.util.Random;import javax.imageio.*;import java.io.File;import java.io.IOException;import java.awt.image.BufferedImage;import java.awt.event.*;import java.util.Calendar; public class JavaApplication1 extends JApplet { public static void main(String[] args) { JFrame frame=new JFrame(); frame.setTitle("hello"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JApplet applete =new JavaApplication1(); applete.init();…write the java mini project and upload the code .class as like this and also provide the screenshot of the code. use these method for insert ,remove and search public boolean insertBook(Book b) { for(int i=0; i<books.length; i++) { if(books[i] == null) { books[i] = b; return true; } } return false; } public boolean removeBook(Book b) { for(int i=0; i<books.length; i++) { if(books[i].getIsbn().equalsIgnoreCase(b.getIsbn())) { for(int j=i; j<books.length-1; j++) { books[j] = books[j+1]; } return true; } } return false; } public Book searchBook(String isbn) { for(int i=0; i<books.length; i++) { if(books[i] != null) {…I'm unable to use the method replaceAll because we have not touch upon it yet, so since the chapter cover loops, here are my 2 codes (Code 1) import java.util.Scanner; public class LabProgram {public static void main(String[] args) {/* Type your code here. */Scanner scnr = new Scanner(System.in);String str= scnr.next();String newStr=""; for (int i=0; i < str.length(); i++) {if (str.charAt(i) == '@')newStr+="";else if (str.charAt(i) == '1')newStr+="";else if (str.charAt(i) == '!')newStr+="";else if (str.charAt(i) == '-')newStr+="";else if (str.charAt(i) == '$')newStr+="";else if (str.charAt(i) == '.')newStr+="";else if (str.charAt(i) == ' ')newStr+="";else newStr= str.charAt(i);}System.out.println(newStr); }} (Code 2) It's the same as the 1st code but I removed the charAt(i) to newStr as in: newStr=str; System.out.println(newStr); This code displayed the string but no nonalpha characters were removed.
- I am not able to get the ID, it jumps straight to GPA, where did i mess up? This is my code : package com.company;import java.util.ArrayList;import java.util.Iterator;import java.util.Scanner;class UniversityPersonnelManagement {public static void main(String[] args) {ArrayList<Student> studentList= new ArrayList<Student>();ArrayList<Faculty> facultyList= new ArrayList<Faculty>();System.out.println("Welcome to my Personal Management Program");for(;;){int input=0;System.out.println(" Choose one of the options:");System.out.println("Add a new Faculty member");System.out.println("Add a new Student");System.out.println("Print tuition invoice for a student");System.out.println("Print information of a faculty");System.out.println("Exit Program");System.out.print(" Enter your selection: ");Scanner s=new Scanner(System.in);try{input=s.nextInt();}catch (Exception e) {System.out.println("Invalid entry- please try again");}if(input==1){Faculty f=new…Input a number n and print out n lines of text in the pattern below, shown for example n = 5 * * * * 1 * * * 2 1 * * 3 2 1 * 4 3 2 1 5 4 3 2 1 There is exactly one space between numbe4rs, there is no space at the end of each line, and each line ends with a newline. The first two tests will ignore the whitespace.Please check images for the rest of the question and provide code with comments and explanations. Thank you. Write a set of static methods, to make console input simpler. Consider that the only console input method using the Scanner class is inputString(), shown below; include it in your solution. This means you are not permitted to use the Scanner class in any of your methods. public static String inputString (){Scanner scan = new Scanner (System.in); // attach to consolereturn ( scan.next() ); // return next string from input console stream}Example of calling and testing this method in your main():String str = inputString(); // get input from console, assign to strdisplayln ("Input A is: " + str); // display input stringdisplayln ("Input B is: " + inputString() ); // get input and display
- I have already written the program and have it right, but I need help write print statement for the testorder class so that the display result looks as shown in the images. I am having trouble getting that right. I will paste the program below so you can run it and attatch the image of display result. Program for Order Class: package homework; import java.util.Date; public class Order { //Declare final variables public static final int ON_ORDER = 0; public static final int CANCELLED = 1; public static final int SHIPPED = 2; //Declare local variables private int totalOrder; private String orderName; private Date date; private int status; private String shippingAddress; private String phoneNumber; private String billingAddress; //Constructor public Order(String name) { this.totalOrder += 1; this.orderName = name; this.status = ON_ORDER; this.date = new Date();} //Cancel the placed order…Please write the Java code for a Time class: Leave comments as explaination for how the code work, and finish the code. Code: import java.util.Scanner; class Main { publicstaticvoid main(String args[]) { Scanner scan = new Scanner(System.in); String timeString; int numMeetings; System.out.print("What time is it now? "); timeString = scan.nextLine(); Time.setCurTime(timeString); System.out.print("Current time: "); Time.showCurTime(); System.out.println(); System.out.print("How many meetings do/did you have today? "); numMeetings = scan.nextInt(); scan.nextLine(); // dispose of newline character } } /* Sample Output: What time is it now? 15:45 Current time: 15:45 How many meetings do/did you have today? 5 What time is meeting #1? 16:00 What time is meeting #2? 16:50 What time is meeting #3? 9:00 What time is meeting #4? 10:00 What time is meeting #5? 15:00 Here are the times for your meetings that are later today: 16:00 16:50 Your last meeting of the day is at 16:50 What…I have a difficult task that i have been given, the problem is that I just simply cant seem to manage to first print a binary number so if you give me six my code doesnt seem to print the number in binary. but also i need to print it in reverse and my code just doesnt seem to work with that. heres my code import java.util.Scanner; public class LabProgram { public static void main(String[] args) { int x; int output; int i; Scanner input = new Scanner(System.in); x = input.nextInt(); output = x; for ( i = 0; i <= x; i = ++i){ output = x / 2; System.out.println(output); } } } // and bellow this are my instructions . what am i doing wrong what am i missing? ive googled sites and erased portions of code, put in eithers. ive switched back and forth from a for loop to a while loop for awhile now Write a program that takes in a positive integer as input, and…
- Write a second convertToInches() with two double parameters, numFeet and numInches, that returns the total number of inches. Ex: convertToInches(4.0, 6.0) returns 54.0 (from 4.0 * 12 + 6.0). import java.util.Scanner; public class FunctionOverloadToInches { public static double convertToInches(double numFeet) {return numFeet * 12.0;} /* Your solution goes here */ public static void main (String [] args) {double totInches; totInches = convertToInches(4.0, 6.0);System.out.println("4.0, 6.0 yields " + totInches); totInches = convertToInches(5.8);System.out.println("5.8 yields " + totInches);}}Is there a particular reason why I do not get the right answer after I choose my option? Entering student ID ( that was previously entered ) and then displayed something different? This is the code : import java.util.ArrayList;import java.util.Iterator;import java.util.Scanner;class UniversityPersonnelManagement {public static void main(String[] args) {ArrayList<Student> studentList= new ArrayList<Student>();ArrayList<Faculty> facultyList= new ArrayList<Faculty>();System.out.println("Welcome to my Personal Management Program");for(;;){int input=0;System.out.println(" Choose one of the options:");System.out.println("1- Add a new Faculty member");System.out.println("2- Add a new Student");System.out.println("3- Print tuition invoice for a student");System.out.println("4- Print information of a faculty");System.out.println("5- Exit Program");System.out.print(" Enter your selection: ");Scanner s=new Scanner(System.in);try{input=s.nextInt();}catch (Exception e)…Write a program that reads a mile in a double valuefrom the console, converts it to kilometers, and displays the result. The formulafor the conversion is as follows:1 mile = 1.6 kilometersHere is a sample run:learn from examplesEnter miles: 96 [ENTER]96 miles is 153.6 kilometers