1. Create a bubble sort code
Q: Please run this program. Thank you import javax.swing.*; import java.awt.*; public class…
A: 1. Save the program wih the same name of class. 2. Use the command prompt to run the program. 3.…
Q: Check.java package Checks; import java.time LocalDate, public class Check ( private double amount;…
A: Check class that represents a check in a banking system. The class contains information about the…
Q: import java.awt.*;import javax.swing.*;import java.util.*; // Model classclass FrogModel {…
A: The Java code you've shared implements a simple MVC (Model-View-Controller) design pattern to create…
Q: Modify the ClockPane class to drawthe clock with more details on the hours and minutes, as shown in…
A: Program: //Import required pacakgesimport javafx.application.Application;import…
Q: JAVA PPROGRAM I have provided the failed test cases and the inputs as a screenshot. Please Modify…
A: Algorithm: Symmetrical Name Matcher1. Start the program.2. Initialize a Scanner object for user…
Q: Implement the Board class. Make sure to read through those comments so that you know what is…
A: Below is the complete solution with explanation in detail for the given question about Board class…
Q: In java Start with the file AList.java and add the following methods: Add the method public int…
A: Here is an updated version of AList.java with the requested methods implemented:
Q: Create a graphical JAVA program that simulates a simple arcade game (like Frogger) using the ACM…
A: Code for particular section :- public void drawRoadMarkers() { / Draw the solid dividing lines…
Q: import java.awt.*;import javax.swing.*;import java.util.*; // Model classclass FrogModel {…
A: The code you provided is a Java implementation of a simple "Frogger" game using the…
Q: * A class to represent a triangle defined by the x- and y-coorindates of its * three corner points…
A: The answer is follows.
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 that does the following: 1. In the main() method complete the following: 1.…
A: import java.util.*;public class Main { static String leaveHospital(ArrayList < Double > []…
Q: import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; //class…
A: Java is an object oriented programming languages. It is used to create the applications in the most…
Q: Implement the Board class. Make sure to read through those comments so that you know what is…
A: A class is a blueprint or template used in object-oriented programming to create objects. Classes…
Q: lo 3 7 8 19 This program will store roster and rating information for a soccer team. Coaches rate…
A: The algorithm of the code is as follows: 1. Create an array of integers of size NUM_PPL. 2. Populate…
Q: Implement the Board class. Make sure to read through those comments so that you know what is…
A: Algorithm:Create a 2D array to represent the game board and initialize it with values in order.Mark…
Q: his is a project I am doing on Java but I can't get it to work somehow on Eclipse. Can you fix it…
A: Define the Runner class:Step 1: Begin the definition of the Runner class.Step 2: Define attributes:…
Q: Please help me fix the errors in this java program. I can’t get the program to work. There are two…
A: Solution: Corrected Code without Errors: AnimatedBall.java import javax.swing.*;import…
Q: Please help me to find out why this code is error
A: There are two possible errors might happen with this program and are as follows:…
Q: as soon as possible. Attach screenshot else downvote
A: I have re-write code below:
Q: package Java2; import java.awt.*; import java.awt.event.*; public class Demo1 { public…
A: In the above code, the main issues are: x, y and z arrays are defined inside the method which…
Q: A contact list is a place where you can store a specific contact with other associated information…
A: In java if you are reading input with .next method then you will read string till first '\n'…
Q: Write Java statements that find the count of numbers in an ArrayList of integers that are greater…
A: Please find the answer below :
Q: Begin with the following code, and the class you defined in #1 (you can assume it works even if you…
A: 1) Create an ArrayList(java) or List(C#) called Deck of PlayingCard(the class you defined in the…
Q: Implement the design of the Spotify class so that the following output is produced: Driver Code…
A: After completing the code, I have provided PYTHON CODE along with CODE SCREENSHOT and…
Q: netbeans using Java use a (for loop) to determine whether a word (string) entered by the user is a…
A: Program Approach: 1- Create the class name as Main. 2- Inside the class name, defines the java…
Q: Assume that class ArrayStack has been defined using the implementation in your textbook. Assume also…
A: Below are all the answers and explanation:
Q: StringBuilder In this lab, we learn how StringBuilder class works and why it is efficient. Type up…
A: In Java, the StringBuilder class is used for extension String manipulation with functions available…
Q: Add a new method to ArrayTools with filter. Make this method accept a String array. Change all the…
A: Array and String in Java - Array is a collection/group of similar type elements. For example, An…
Q: Write a for loop that prints: 1 2 … countNum Ex: If the input is: 4 the output is: 1 2 3 4
A: import java.util.Scanner;public class Main{ public static void main(String[] args) { int countNum;…
Q: Implement the Board class. Make sure to read through those comments so that you know what is…
A: Algorithm for Board Class:Class Definition:Define the Board class with constants for movement…
Q: Need to solve parts 3 through 5 for the code Code will need to be placed where is says: YOUR CODE…
A: In part 3, you need to reset total units and total grade points variables values. Resetting values…
Q: In Java. Sort the list of cars and display them. Sort by make, model, and year. Each car property…
A: Hey there, I am writing the required solution of the above stated question.Please do find the…
Q: Write a program to test the class LinkedBag.
A: write a java program to test the calss linked bag
Q: Java a code give out what is on the image. Essentially write in the main function so that it prints…
A: This program provides information about the total score of the game , according to the points x and…
Q: Siven positive integer numinsects, write a while loop that prints that number doubled without…
A: ALGORITHM: STEP 1: create a class called InsectGrowth. STEP 2: In main class using the scanner to…
Q: modify my java matching with the image provide below or at least fix the errors import java.awt.*;…
A: The correct answer for the above mentioned question is given in the following steps for your…
Q: Java Program ASAP Please pay attention to the screenshot for test case 2 and 3 and please make…
A: FileSorting Algorithm1. Start2. Initialize Scanner object 'scanner' to read user input3. Loop until…
Q: Please do not give solution in image format thanku packagecom.abc.base; public class MyDataTypes {…
A: Algorithm: Start the program. Declare and initialize two variables a and b with their respective…
Q: Declare and implement a class named MyString. This class will have a string data members and the…
A: Given data, A class named Mystring. This class will have a string of data members and the following…
Q: this does not work in Eclipse Java, please you can fix it?
A: Answer: This is working fine in eclipse, if the program is having errors then you need to import the…
Q: Java Question- Convert this source code into a GUI application using JOptionPane. Make sure the…
A: Java Question- Convert this source code into a GUI application using JOptionPane. Make sure the…
Q: Implement the Board class. Make sure to read through those comments so that you know what is…
A: To implement the Board class, you'll need to define constructors and methods to perform various…
Q: JAVA SWING I have definied a straight TUBE as: int rectWidth = 25; // replace 50 with the desired…
A: To define an L tube, you can modify the code to create two rectangles, one for the horizontal part…
Q: Complete asvsson as possible and Attach screenshot of code and output as well.
A: import java.util.Scanner;public class SquareBoard{ private String [][] board; private int length;…
Q: Write a program that reads a list of integers from input and determines if the list is a palindrome…
A: Read the input integer n from the user, which represents the number of integers in the list. Create…
Q: EXPLAIN EACH OF THE FOLLOWING LINE. import java.awt.*; import java.awt.geom.*; 3 .import…
A: Ans 1: import java.awt.* --used to import (Abstract Window Toolkit) API to develop Graphical User…
Please help me with this using java. If yo can't do all of them just do #1 and #3
1. Create a bubble sort code
2. Create a matching games like the on below. And add a reset button ( refer to image below)
3. please add comments to the tower of Hanoi java code below
import java.util.Scanner; public class TowerOfHanoi { public static void shift(int n, String startPole, String intermediatePole, String endPole) { if (n == 0) { return; } shift(n - 1, startPole, endPole, intermediatePole); System.out.println("Move \"" + n + "\" from " + startPole + " --> " + endPole); shift(n - 1, intermediatePole, startPole, endPole); } public static void main(String[] args) { System.out.print("Enter number of discs: "); Scanner scanner = new Scanner(System.in); int numberOfDiscs = scanner.nextInt(); shift(numberOfDiscs, "Pole1", "Pole2", "Pole3"); } }
Step by step
Solved in 5 steps with 3 images
- You have to use comment function to describe what each line does import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class PreferenceData { private final List<Student> students; private final List<Project> projects; private int[][] preferences; private static enum ReadState { STUDENT_MODE, PROJECT_MODE, PREFERENCE_MODE, UNKNOWN; }; public PreferenceData() { super(); this.students = new ArrayList<Student>(); this.projects = new ArrayList<Project>(); } public void addStudent(Student s) { this.students.add(s); } public void addStudent(String s) { this.addStudent(Student.createStudent(s)); } public void addProject(Project p) { this.projects.add(p); } public void addProject(String p) { this.addProject(Project.createProject(p)); } public void createPreferenceMatrix() { this.preferences = new…Please help me comment these lines of code. Please not these are just some lines of code that have been taken from the java program I am creating which is a coin toss program. I do not need you to create one. Just comment what the lines of code below private static String sideUp; } public void toss() { Random in = new Random(); int x = in.nextInt(); if (x % 2 == 0) sideUp = "Heads"; else sideUp = "Tails"; } public static void main(String[] args) { int tail = 0, head = 0; System.out.println("\nTossing coin 20 times:-"); for (int i = 1; i <= 20; i++) { coin.toss(); if (coin.getFace().equals("tails")) tail++; else head++;The first one is answered as follows. Help with the second one. package test;import javax.swing.*;import java.awt.*;import java.awt.event.*; public class JavaApplication1 { public static void main(String[] arguments) { JFrame.setDefaultLookAndFeelDecorated(true);JFrame frame = new JFrame("print X and Y Coordinates");frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout());frame.setSize(500,400); final JTextField output = new JTextField();;frame.add(output,BorderLayout.SOUTH); frame.addMouseListener(new MouseListener() {public void mousePressed(MouseEvent me) { }public void mouseReleased(MouseEvent me) { }public void mouseEntered(MouseEvent me) { }public void mouseExited(MouseEvent me) { }public void mouseClicked(MouseEvent me) {int x = me.getX();int y = me.getY();output.setText("Coordinate X:" + x + "|| Coordinate Y:" + y);}}); frame.setVisible(true);}}
- Please help me fix the errors in the java program below import javax.swing.*; import java.awt.event.*; import java.awt.*; public class Halloween extends JFrame implements ActionListener { int hallo[][] = { { 4, 6, 2 }, { 1, 4, 3 }, { 3, 5, 2 }, { 2, 3, 5 }, { 4, 1, 3 } }; int rows = 3; int cols = 5; JButton pics[] = new JButton[rows * cols]; public Halloween() { setSize(600, 600); JPanel grid = new JPanel(new GridLayout(rows, cols)); int m = 0; for (int x = 0; x < rows; x++) { for (int y = 0; y < cols; y++) { pics[m] = new JButton(createImageIcon("back.png")); pics[m].addActionListener(this); pics[m].setActionCommand(m + ""); pics[m].setPreferredSize(new Dimension(100, 100)); grid.add(pics[m]); m++; } } add(grid); setVisible(true); } public void actionPerformed(ActionEvent ae) {}if(e.getActionCommand().equals("Reset")) { for (int m = 0; m…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 37Implement the Board class. Make sure to read through those comments so that you know what is required. import java.util.Arrays; import java.util.Random; public class Board { public static final byte UR = 0; public static final byte R = 1; public static final byte DR = 2; public static final byte DL = 3; public static final byte L = 4; public static final byte UL = 5; // You need a random number generator in order to make random moves. Use rand below private static final Random rand = new Random(); /** * Construct a puzzle board by beginning with a solved board and then * making a number of random moves. Note that making random moves * could result in the board being solved. * * @param moves the number of moves to make when generating the board. */ public Board(int movement) { // TODO }
- Write this code to get 7 inputs: import javax.swing.*;import java.awt.*;import java.awt.event.*; class WeeMadLib implements ActionListener { JFrame wmlGame = new JFrame("Wee Mad Lib");JPanel gameBoard = new JPanel(new GridLayout(3,3)); JLabel subjectLabel = new JLabel("Subject");JLabel verbLabel = new JLabel("Verb");JLabel objectLabel = new JLabel("Object"); JLabel subject = new JLabel("My friend ");JTextField verb = new JTextField(25);String[] objectOptions = { " a ball."," chickens."," a kazoo.", " an igloo." };JComboBox object = new JComboBox(objectOptions); JButton clear = new JButton("Clear");JTextArea sentence = new JTextArea("My friend ___ ___.");JButton exit = new JButton("Exit"); public WeeMadLib() { wmlGame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); wmlGame.setSize(300,300); subjectLabel.setOpaque(true); subjectLabel.setBackground(new Color(0,255,255)); subjectLabel.setHorizontalAlignment(JLabel.CENTER); sentence.setEditable(false); sentence.setOpaque(false);…can you help me to deaw the flow chart for the java code below: import java.util.Scanner;class DataItem {private int iData;public DataItem next;public DataItem(int i) {iData = i;}public int getKey() {return iData;}public void displayDataItem() {System.out.print(iData + " ");}}class SortedList {private DataItem first;public void SortedList() {first = null;}public void insert(DataItem dItem) {int key = dItem.getKey();DataItem previous = null;DataItem current = first;while (current != null && key > current.getKey()) {previous = current;current = current.next;}if (previous == null) {first = dItem;} else { previous.next = dItem;}dItem.next = current;}public void delete(int key) {DataItem previous = null;DataItem current = first;while (current != null && key != current.getKey()) {previous = current;current = current.next;}if (previous == null) {first = first.next;} else {previous.next = current.next;}}public DataItem find(int key)…PRACTICE CODE import java.util.TimerTask;import org.firmata4j.ssd1306.MonochromeCanvas;import org.firmata4j.ssd1306.SSD1306;public class CountTask extends TimerTask {private int countValue = 10;private final SSD1306 theOledObject;public CountTask(SSD1306 aDisplayObject) {theOledObject = aDisplayObject;}@Overridepublic void run() {for (int j = 0; j <= 3; j++) {theOledObject.getCanvas().clear();theOledObject.getCanvas().setTextsize(1);theOledObject.getCanvas().drawString(0, 0, "Hello");theOledObject.display();try {Thread.sleep(2000);} catch (InterruptedException e) {throw new RuntimeException(e);}theOledObject.clear();theOledObject.getCanvas().setTextsize(1);theOledObject.getCanvas().drawString(0, 0, "My name is ");theOledObject.display();try {Thread.sleep(2000);} catch (InterruptedException e) {throw new RuntimeException(e);}while (true) {for (int i = 10; i >= 0; i--)…
- need help finishing/fixing this java code so it prints out all the movie names that start with the first 2 characters the user inputs the code is as follows: Movie.java: import java.io.File;import java.io.FileNotFoundException;import java.util.ArrayList;import java.util.Scanner;public class Movie{public String name;public int year;public String genre;public static ArrayList<Movie> loadDatabase() throws FileNotFoundException {ArrayList<Movie> result=new ArrayList<>();File f=new File("db.txt");Scanner inputFile=new Scanner(f);while(inputFile.hasNext()){String name= inputFile.nextLine();int year=inputFile.nextInt();inputFile.nextLine();String genre= inputFile.nextLine();Movie m=new Movie(name, year, genre);//System.out.println(m);result.add(m);}return result;}public Movie(String name, int year, String genre){this.name=name;this.year=year;this.genre=genre;}public boolean equals(int year, String genre){return this.year==year&&this.genre.equals(genre);}public String…Modify this code to make a moving animated house. import java.awt.Color;import java.awt.Font;import java.awt.Graphics;import java.awt.Graphics2D; /**** @author**/public class MyHouse { public static void main(String[] args) { DrawingPanel panel = new DrawingPanel(750, 500); panel.setBackground (new Color(65,105,225)); Graphics g = panel.getGraphics(); background(g); house (g); houseRoof (g); lawnRoof (g); windows (g); windowsframes (g); chimney(g); } /** * * @param g */ static public void background(Graphics g) { g.setColor (new Color (225,225,225));//clouds g.fillOval (14,37,170,55); g.fillOval (21,21,160,50); g.fillOval (351,51,170,55); g.fillOval (356,36,160,50); } static public void house (Graphics g){g.setColor (new Color(139,69,19)); //houseg.fillRect (100,250,400,200);g.fillRect (499,320,200,130);g.setColor(new Color(190,190,190)); //chimney and doorsg.fillRect (160,150,60,90);g.fillRect…Write a brief reflection on the Arrays along with your own codes in java after completing MOOC Course (link is given below) within 300 words. @Udemy: Introduction to programming with Java https://www.udemy.com/share/101sVG/.