************Answer question below************* Create UML Class Diagram and java source file. +push(String) +pop() +peek() +search(String key) +isEmpty() +print()
Q: Replacing word game. Take a string from user and replace all the instances of i with we and am with…
A: Required:- Replacing word game. Take a string from the user and replace all the instances of I with…
Q: rite a program Java to search for the key element from the give list and display its location using…
A: Below is the given code-
Q: Hi, could I ask how I can solve this problem in Java using priority queues? (Included variables)…
A: The solution is below:
Q: Using conditional operators to determine whether a year is a leap year or not. All years earlier…
A: Using conditional operators to determine whether a year is a leap year or not.All years earlier than…
Q: i need life cycle and comments on these codes (example: int x; // declare x ; ) VB Code…
A: Commenting in Visual Basic There are basically two ways to comment in VB. By using the REM keyword,…
Q: Run the code in Netbeans and provide screenshots to verify that it runs successfully
A: The code is sorted line by line and also the comments have been added in the source code itself to…
Q: Question: You are required to implement a preprocessor in Java. Your preprocessor should be able to…
A: Check the solution below.
Q: Java assignment Create a java program that allows a user to input customer records (ID number, first…
A: Answer:
Q: i. A Queue is used for Last-In-First-Out (LIFO) scenarios. True/False ii. Write code snippet to…
A: Part(i) A queue is a linear structure in which operations are carried out in a specific order.…
Q: Can you please help update this? //A6Utilities.java import java.io.IOException; import…
A: This is the best method for doing the graded problem Ask the user to enter their final average and…
Q: (In java please) ( NO TOY CLASS PLEASE READ INSTRUCTION OR DOWN VOTE PLEASE LOOK AT TWO IMAGES BELOW…
A: LinkNode.java public class LinkNode { private Toy data=null; private LinkNode next;…
Q: The main thread of a Java program can generate additional threads. true or false It is possible to…
A: Objective: Two statements are given regarding computer programming and they need to be verified if…
Q: Can someone help me to correct the error of this code so that it is able to run at Jeliot tool?
A: The code in this particular file is correct. Just implement Output.java in jeliot.io correctly. You…
Q: Indexed Addressing A = base R = displacement EA = A + R Good for accessing arrays - EA = A + R - -…
A: In indexed addressing mode the final effective address of the operand is calculated by adding a…
Q: import java.io.File; import java.io.FileReader; import java.io.FileNotFoundException; import…
A: The error in the program is it cannot open the file for reading so you have to make sure that the…
Q: 1. Assume employees of an organization share a network printer. All printing requests are stored in…
A: 1) ALGORITHM: STEP 1: Create a class name Printer and assign the priority of the queue going to…
Q: Complete the following tasks in Java. Create Login Feature and Registration Feature. Implement OOP…
A: Coded using Java.
Q: QUESTION 1 Write Java program to implement the land routes between the cities Salalah, Muscat,…
A: Answer: I have done code and also I have attached code as well as code screenshot.
Q: Write a programe which has function name RemoveDuplicates() which takes a list sorted in increasing…
A: Answer in step2
Q: Implement your library model that you designed earlier. Write a main program that creates a library…
A: Your C++ program is given below as you required with an output.
Q: -ices.size(); import java,util.Scanners import java.util.Arraylisti publie class Cashilegister…
A: Code: private ArrayList<Double> prices = new ArrayList<>(); public int getCount() {…
Q: Question: You are required to implement a preprocessor in Java. Your preprocessor should be able to…
A: The for loop in Java is an entry controlled loop that allows a user to execute a block of a…
Q: - Analyse the case study given ( Linked list ) Answer the following questions from Library.java. 1.…
A: A linked list is a linear data structure in which elements are not stored at contiguous memory…
Q: Problem1. Write a java program that will PUSH and POP element using Stacks. Filename:…
A: The Java Code is given Below:
Q: J Jane B Bill S Sam B1 Bob B2
A: We need to write a java code for build map object.
Q: JAVA - Please produce both a product.java file and a productprinter.java file (tester) Implement a…
A: public class mainClass { public static void main(String[] args) { emp pcost = new emp();…
Q: (Java) Activity 4.4 DO PART 2! PART 2 IS BASED OFF PART 1!!! PART 1: Open up Eclipse and create…
A: NOTE - As stated in the question, I have done Part 2, in which we need to implement the function to…
Q: 浙江工业大学考试命题纸 port java.util1.Scanner; blic class DigitReverse { protected int num; nyRlis…
A: The Java code for the given problem statement is below:
Q: Run the following Java code in Netbeans and draw a UML class diagram to model the program. Java…
A: The given Program is as follows, File name: “experiment.java” //include the required package import…
Q: Write a c++ program to simulate a coffee shop or a Mcdonald's drive-thru where different customers…
A: "#include <iostream> #include <queue> using namespace std; class Customer {…
Q: Can Someone help me fix this error the code is written in java... import java.util.*; class HPF…
A: We are getting invalid method declaration because in our code name of class and name of constructor…
Q: Convert the following python class into JavaScript class. class Logging: """all methods related…
A: Conversion of python code to java script:-
Q: STUDENT RECORD CODE package com.java.runner; import java.io.BufferedReader; import…
A: The finally block is used to ensure resources are recovered regardless of any problems that may…
Q: Create the UML Diagram for this java code import java.util.Scanner; interface Positive{…
A: The class diagram is one of the UML diagrams. The class diagram contains all the interfaces and…
Q: 1. Write a Java program to create a new tree set, add colors ["RED","GREEN","BLACK","WHITE","PINK"]…
A: As per our company guidelines, we are not supposed to answer more than three subparts of post and…
Q: sortsearchassigncodeex1.java sort, search for a specific student package…
A: If the input array is not sorted, the results are undefined and negative. If there are duplicates,…
Q: i need comments on the code example: int x; // declare x and life cycle VB Code Imports…
A: Commenting in Visual Basic Comments in VB can be made in two ways: Using REM keyword, and Using a…
Q: import java.io.*; class Super { void show() { System.out.println("parent"); } } public class Sub…
A: as per Bartleby guidelines we are supposed to answer?️ only one question. Kindly repost other…
Q: Java homework questions: Answer all exercises Not copied answer plzz Exercise 1 • Import and edit…
A: The code for the implementation of the the first program is as follows: import java.util.Scanner;…
Q: Removing comments 2. Identifying built-in language constructs 3. Identifying loops and methods
A: solution in below step
Q: shell sort: 21, 4, 25, 16, 12, 17
A: Shell Sort(SS) => It is mostly a variation of Insertion Sort. => In insertion sort, we…
Q: 5. Build/design a TM that accepts all words of the form aba(c)*bab, loops forever on all words that…
A: Task : Define the Turing machine that accepts the language : accepts words of form = aba(c)+bab…
Q: package Q2; import java.io.FileInputStream; import java.io.FileNotFoundException; import…
A: package Q2;import java.io.FileInputStream;import java.io.FileNotFoundException;import…
Q: In Java: -Using a BST Interface (Binary Search Tree) -Create a class Disk. Disk contains four…
A: Answer: our instruction is answer the first three part from the first part and . I have done code in…
Q: Output of public class Test implements Runnable { public void run() { System.out.println(…
A: Given: public class Test implements Runnable { public void run() { System.out.println( "running!" );…
Q: Implement Tower of honai in Java by using Stack. Towers Disks Smallest Largest The mission is to…
A: Implement TOWER OF HANOI USING JAVA OR STACK implementation
Q: How do I implement a file with sets of numbers, such as 0 4 2 6 0 9 1 5 to an adjacency matrix
A: An adjacency matrix is a V x V binary matrix A (a binary matrix is a matrix in which the…
Q: NameSorter.java Name.java import java.util.Scanner; import java.util.ArrayList; import…
A: code: import java.util.*;public class Main{ public static void main(String[] args) { Scanner scnr =…
Q: the java file is here. and the question is attached as a photo. i //…
A: Code: import java.util.Scanner; public class ParseInts { public static void main(String[] args) {…
************Answer question below*************
Create UML Class Diagram and java source file.
+push(String)
+pop()
+peek()
+search(String key)
+isEmpty()
+print()
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
- * Ryan Chin CS 111B Assignment 4 Count Words and display longest word */ import java.util.Scanner; public class Main { publicstaticvoid main(String[] args) { String phrase; int numWords; phrase = inputPhrase(); numWords = analyzePhrase(phrase); System.out.println("Your phrase has " + numWords + " words in it."); System.out.println(); } /** inputPhrase method Ask the user to input a phrase, and make sure it is at least 5 characters long. (Use a loop to make the user input a new phrase if it is too short.) @return the phrase */ // INSERT YOUR CODE HERE static String inputPhrase() { Scanner scan = new Scanner(System.in); String phrase; boolean keepSearching; do { keepSearching = false; System.out.println("Please enter a phrase all on one line, " + "with just one space separating each word, and no spaces " + "at the beginning or end of the phrase."); phrase = scan.nextLine(); if(phrase.length()<5) { keepSearching = true; System.out.println("Your phrase must contain at least 5…please help me with the following 1) make a sierpenski triangle using java and recursion. Make it similar to the code below. And please comment the code 2) Please make the follow code out put on the console. It a t square fractal import java.awt.image.*;import java.awt.Color;import java.io.*;import javax.imageio.*; public class Main{ static final int DIMENSION = 1000; static BufferedImage image = new BufferedImage(DIMENSION, DIMENSION, BufferedImage.TYPE_INT_RGB); static final int WHITE = Color.WHITE.getRGB(); static final int BLACK = Color.BLACK.getRGB(); private static void drawSquare(int x, int y, int side) { if (side <= 0) return; else { int left = x - side/2; int top = y - side/2; int right = x + side/2; int bottom = y + side/2; for (int i = left; i < right; i++) for (int j = top; j < bottom; j++) { image.setRGB(i, j, BLACK); }…SumDouble.java [1 13 14 14 27 28 * Logic problem for CS 170. @author * @version */ public class SumDouble /** * Complete the function sumDouble(). * Given two int values, return their sum. * Unless the two values are the same; * then return double their sum. * Some examples sumDouble (1, 2) returns 3 sumDouble (3, 2) returns 5 sumDouble (2, 2) returns 8 @param a is the first int value. * @param b is the second int value. * @return their sum or double their sum if equal. */ public int sumDouble(int a, int b) { // Complete the sumDouble method here.
- StringFun.java import java.util.Scanner; // Needed for the Scanner class 2 3 /** Add a class comment and @tags 4 5 */ 6 7 public class StringFun { /** * @param args not used 8 9 10 11 12 public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Please enter your first name: "); 13 14 15 16 17 18 System.out.print("Please enter your last name: "); 19 20 21 //Output the welcome message with name 22 23 24 //Output the length of the name 25 26 27 //Output the username 28 29 30 //Output the initials 31 32 33 //Find and output the first name with switched characters 34 //All Done! } } 35 36 37JvExampleja 1 package com.beginnersbook 2 import java.util.Scamer; 3 public class JavaExomple 4 ( 16 17 18 19 ) public static void main(String args[]) ( } float p, r, t, sinterest; Scorner scon new Scanner(Systen, (e); System.out.print("Enter the Principal: "); pscan.nextFloat(); System.out.print("Enter the Rate of interest: "); scan.nextFloat(); System.out.print("Enter the Time period: "); tscan.nextFloat(); scon.close(); sinterest (1)/100; System.out.print("Simple Interest is: interest); Problems Declaration Console Progress Cover JavaExample Java Application Library/JavalavaVirtual Machines|ck-2. Enter the Principel: 2000 Enter the Rate of interest: Enter the Time period 3 Simple Interest is: 360.0 Jevadopublic class Question1 {public static void main(String[] args) {double val;int counter = 0;int numIterations = 0;/*** Part a: Implement a branching condition that increases counter by 1 if val is larger than 0.5*/val = Math.random();/*** Part b: Add a loop around the code created in Part a that continues until counter equals 3.*//*** Part c: Use the variable numIterations to count how many times your loop in Part b iterates*/System.out.println("Number of Iterations until 3 random values greater than 0.5 were generated: "+ numIterations);}}
- *Java* Question: Is my code correct? Please answer if it’s correct or not and why? ———————————————- *CODE* import java.util.Scanner; import java.io.*; public class Assignment3{ public static void main(String[] args){ PrintWriter output = null; try{ Scanner input = new Scanner(new File("students.txt")); output = new PrintWriter("Result.txt"); while(input.hasNextLine()){ String fName = input.next(); String lName = input.next(); double test1 = input.nextDouble(); double test2 = input.nextDouble(); double finalTest = input.nextDouble(); double total = test1*0.2+test2*0.2+finalTest*0.6; if(total>=60) output.println(fName+" "+lName+" "+total+" PASS"); } output.close(); } catch(FileNotFoundException e){ System.out.println("Error: "+e.getMessage()); } } }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 42Java use loop Write code for following attach output of code. Code in Java Output
- Write code in Java: -Must be recursive import java.util.*; import java.lang.*; import java.io.*; //*Analysis goes here* //*Design goes here* class AllPermutation { public static void displayPermutation(String s) { //*Code goes here* } public static void displayPermutation(String s1, String s2) { //*Code goes here* } } //*Driver class should not be changed* class DriverMain { public static void main(String args[]) { Scanner input = new Scanner(System.in); AllPermutation.displayPermutation(input.nextLine()); } }main.cpp:4:17: error: 'string' has not been declared 4 | void KMPSearch(string pat, string txt) main.cpp:4:29: error: string' has not been declared 4 | void KMPSearch(string pat, string txt) Aununun main.cpp:31:25: error: string' has not been declared 31 | void computelPSArray(string pat, int M, int[] lps) main.cpp:31:50: error: expected or . before lps' 31 | void computeLlPSArray(string pat, int M, int[] lps) main.cpp:55:8: error: expected :' before 'static' 55 | public static void Main() main.cpp:61:2: error: expected ;' after class definition 61 | } | main.cpp: In member function 'void GFG::KMPSearch(int, int)': main.cpp:6:15: error: request for member Length' in 'pat', which is of non-class type 'int' 6 | int M = pat.Length; main.cpp:7:15: error: request for member Length' in txt’, which is of non-class type 'int' int N = txt.Length; main.cpp:8:6: warning: structured bindings only available with -std3c++17' or (-std=gnu++17' 8 | int[] lps new int[M];13 public class MaxMinAtLeastOneValue 14 {. public static void main(String[] args) { Scanner in = new Scanner (System.in); 15 16 17 18 // Step 2: Read in an integer as the count of double values 19 wit an input prompt "Enter the count of values: and store it in a variable // 20 21 // 22 23 // Step 3: Read in a double value with an input prompt 24 25 "Enter the first value: and store it in a variable max 26 27 28 // Step 4: Assign the value of max to another 29 // variable min 30 31 32 // Step 5: Use a for loop to read all remaining double values with an input prompt 33 // 34 // "Enter the next value: 35 // and update max and min 36 37 saved