Assign isTeenager with true if kidAge is 13 to 19 inclusive. Otherwise, assign isTeenager with false.
Q: Need help solving this issue. ShoppingList Class import java.util.Scanner; import…
A: There are some modifications required in the ShoppingList class. The changes are shown below:
Q: Please implement the Book search(Object e). This method returns the object being search if not found…
A: Here we need to iterate over the ArrayList we have and when we have a matching Book we are going to…
Q: Implement changeArrayLength(int m) – void method; public class Course { public String code;…
A: Answer: I have done code in java and also I have insert the code
Q: UML diagram for the java code below public class CourseDBManager implements…
A: UML has a totally comprehensive notation for finite nation machines. Figure 1-6 suggests simplythe…
Q: Show the expected output of the following program: package ch09.apps; import ch09.priorityQueues. *;…
A: See the expected output for above code in second step.
Q: Expand the wedding class to include six weddings. import java.time.*; public class TestWedding {…
A: import java.util.*;import java.lang.*;import java.io.*;import java.time.*; //define a class…
Q: Study the following method carefully which can be related to a certain class, decide what does it…
A: A binary tree is a tree where every node in the tree will have a maximum of two children A binary…
Q: class A {protected int x1,1,2; public: A(a, b,c):x1(a+2),y1(b-1),z(c+2) { for(i=0; i<5;i++)…
A: Explanation: Consider the given code. The values of k, m, and n are 4, 2, and 5 respectively. The…
Q: Create a public class GraphAnalysis that provides a single static method named isUndirected.…
A: ANSWER:-
Q: Implement an immutable class MyBigInteger using String Provide methods toString, add and…
A: Step 1 The answer is given in the below step
Q: Define the missing method. Use "this" to distinguish the local member from the parameter name. //…
A: Program code: File name: CablePlan.java //define a class CablePlan public class CablePlan {…
Q: 2. Modify the method in Question 1 so that the item with the highest key is not only returned by the…
A: I think the given code is correct, the problem with the code is that it is not displaying the output…
Q: public class FindArrayDifference { static void arrayDifference(int a[], int b[]) {…
A: We are given a piece of code for which we need to calculate step number and time complexity.…
Q: Using only LLNode.java class. Create a demo cass called LinkedListDemo.java. In this demo class,…
A: as par your requirement with output Code in Java: sum will store at the end. class sumOfNode {…
Q: import java.util.Scanner; import java.util.HashSet; public class GroceryList { public static void…
A: Program: import java.util.Scanner;import java.util.HashSet;public class Main { public static void…
Q: Discrete distribution. Write a program DiscreteDistribution.java that takes an integer command-line…
A: public class DiscreteDistribution { public static void main(String[] args) { // read in…
Q: in the last line of to string there is error can you solve it package log; import…
A: In function toString() of your program the problem is in quotations that you have inserted. Refer to…
Q: public class GraduateStudent extends Student{ public int a ge; eoverride public String toString () {…
A: output in line number 20 and 21 for the above java code
Q: Code Example 18-2 1. import tkinter as tk 2. from tkinter import ttk 3. class…
A: WIndow is :
Q: Let the domain be the set of all people. Let: P(x): "x has a vinyl record turntable". Q(x): "x is a…
A: ~p(x) : x has not a vinyl record turntable Q(x) : x is a fan of music ^ means and there exist…
Q: Please use the information in the second screenshot about the BST class and Node class to create a…
A: Answer is given below .
Q: help me run this code import java.util.*; class Main{ static int max_kids; HashMap > sports ;…
A: Given: To run the given code without error.
Q: public class Solution { public static void main(String[] args) { Scanner sc = new Scanner…
A: Your main logic remained same and for better understanding we are writing some print statements
Q: public class Book implements Comparable { protected int pages; public Book () { pages - 1500; public…
A: Here I have created a class Book that implements the Comparable interface. Inside the class, I have…
Q: //PLEASE CORRECT MY MISTAKES, THANK YOU public class Person { private String personID; private…
A: As per the question, solution is mentioned below:
Q: Please fix this code. 4.6.1: Overload salutation printing. Complete the second printSalutation()…
A: Coded using Java Language.
Q: Code Example 18-2 1. import tkinter as tk 2. from tkinter import ttk 3. class…
A: -> Line number 13 is used to enter the value but it refers to the tipPercent. So it is not an…
Q: class Solution { public: { int first UniqChar(string unordered_map m; return -1;
A:
Q: Consider the following class: 1 public class Student { 2 private int studentNumber; 3 private…
A: OOP or Object-Oriented Programming is a software model that is designed around data or objects…
Q: class Solution { public: int i++) { { firstUniqChar(string s) { unordered_map m; for (int i=0;…
A: The program for the above given question is given below:
Q: Write a unit test for addInventory(), which has an error. Call redSweater.addInventory() with…
A: Program code: // Header files #include <iostream> //std using namespace std; // Define…
Q: Write the output produced when the following method is passed each of the following maps: public…
A: Actually, given code is: public static void mystery(Map<String, String> m) { Set<String>…
Q: What does the method printStuff) print? public class Vehicle public String tostring () return…
A: Please refer to the following steps for the complete solution of the problem above.
Q: 1 package package1; 2 3 public class Operation { 40 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22…
A: As per guidelines we are supposed to answer only one question. Kindly repost other questions a…
Q: class A {protected int x1,y1,z; public: A(a, b,c):x1(a+2),y1(b-1),z(c+2) { for(i=0; i<5;i++) x1++;…
A: Answer: x1 -> 11, y1 -> 2 and z -> 8
Q: In each plastic container of Pez candy, the colors are stored in random order. Your little brother…
A: Java used to answer this question
Q: Public classTestMain { public static void main(String [ ] args) { Car myCar1,…
A: Solution: Given,
Q: Convert the following python class into JavaScript class. class Logging: """all methods related…
A: Conversion of python code to java script:-
Q: import java.at."; import javax. swing."; public class RectangleMonday etends JFrame{ public…
A: Introduction of Program: The java program uses the concept of JFrame and it provides a window on the…
Q: class A {protected int x1,y1,z; public: A(a, b,c):x1(a+2),yl(b-1),z(c+2) { for(i=0; i<5;j++) x1++;…
A: Answer: x1 -> 11, y1 -> 2 and z -> 8 See below step for explanation.
Q: Make this generic, instead of a Stack of Pancake. public class Stack { private ArrayList…
A: Stack in java programing
Q: Create a public class GraphAnalysis that provides a single static method named isUndirected.…
A: Answer: Here just asking how to configure that question .
Q: public static CS150 getInstance(){ //TODO implement a single return null; }
A: public static CS150 getInstance(){ return (new CS150()); }
Q: Here is my code in Java: import java.util.Scanner; import java.util.HashMap; public class…
A: Your code had some mistakes due to which it was going into an infinite loop which resolved. Now this…
Q: Suppose a method TreeNode find(String userString)finds a TreeNode object with label equal to…
A: Here have to determine correct option for tree structure problem.
Q: @return index of the point that is closest to the origin, which is (0, 0) * In case of a tie,…
A: ALGORITHM:- 1. Calculate the distance of the points from the origin. 2. Return the point with…
Q: implement changeArrayLength(int m) – void method; public class Course { public String code;…
A: From what us understandable in the question, find the implementation below.
Q: Given main() and an IntNode class, complete the IntList class (a linked list of IntNodes) by writing…
A: Given main() and an IntNode class, complete the IntList class (a linked list of IntNodes) by…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- UML diagram for the java code below public class CourseDBManager implements CourseDBManagerInterface { private CourseDBStructure dataMgr = new CourseDBStructure(20); public void readFile(File inputFile) throws FileNotFoundException{ try { Scanner fileData = new Scanner(inputFile); while(fileData.hasNext()) { String id = fileData.next(); int crn = fileData.nextInt(); int numCredits = fileData.nextInt(); String roomNum = fileData.next(); String instructor = fileData.nextLine(); add(id, crn, numCredits, roomNum, instructor); } fileData.close(); } catch(FileNotFoundException e) { System.out.print("File not found"); e.getMessage(); } } public void add(String id, int crn, int credits, String roomNum, String instructor) { CourseDBElement newElement = new CourseDBElement(id, crn, credits, roomNum, instructor); dataMgr.add(newElement); } public…import java.util.Scanner; public class PetInformation {public static void main(String[] args) {Scanner scnr = new Scanner(System.in); Pet myPet = new Pet(); Cat myCat = new Cat(); String petName, catName, catBreed; int petAge, catAge; petName = scnr.nextLine(); petAge = scnr.nextInt(); scnr.nextLine(); catName = scnr.nextLine(); catAge = scnr.nextInt(); scnr.nextLine(); catBreed = scnr.nextLine(); // Create generic pet (using petName, petAge) and then call printInfo myPet.setName(petName); myPet.setAge(petAge); myPet.printInfo(); // Create cat pet (using catName, catAge, catBreed) and then call printInfo myCat.setName(catName); myCat.setAge(catAge); myCat.setBreed(catBreed); myCat.printInfo(); // Use getBreed(), to output the breed of the cat System.out.println(" Breed: " + myCat.getBreed());}}Define the missing method. Use "this" to distinguish the local member from the parameter name. // ===== Code from file CablePlan.java =====public class CablePlan {private int numDays; // FIXME: Define setNumDays() method, using "this" implicit parameter.public void setNumDays(int numDays) { /* Your solution goes here */ } public int getNumDays() {return numDays;}}// ===== end ===== // ===== Code from file CallCablePlan.java =====import java.util.Scanner; public class CallCablePlan {public static void main(String [] args) {Scanner scnr = new Scanner(System.in);CablePlan house1Plan = new CablePlan();int userNum; userNum = scnr.nextInt();house1Plan.setNumDays(userNum);System.out.println(house1Plan.getNumDays());}}// ===== end =====
- TRANSLATE TO PYTHON import java.util.*; public class queen { finalprivateint [][] map = newint[8][8]; finalprivateint [][] testMap = newint[8][8]; privateintheuristic = 0; privateintqueenLocs = 0; privateintrestarts = 0; privateintmoves = 0; privateintneighbors = 8; publicqueen( ){ //initializes the map for(inti = 0; i < 8; i++){ for(intj = 0; j < 8; j++){ map[i][j] = 0; } } } publicvoidrandomizeMap( ){ //randomizes the map Randomrand = newRandom( ); intnum; while(queenLocs < 8){ for(inti = 0; i < 8; i++){ map[rand.nextInt(7)][i] = 1; queenLocs++; } } heuristic = heuristic(map); } //***************************Heuristic****************************// publicbooleanfindRowEx(int [][] test, inta){ //determines row conflicts booleanexFound = false; intcount = 0; for(inti = 0; i < 8; i++){ if(test[i][a] == 1){ count++; } } if(count > 1){ exFound = true; } returnexFound; } publicbooleanfindColEx(int [][] test, intj){ //determines column conflicts booleanexFound =…the code: class HighArray { private long[] a; private int nElems; public HighArray(int max) { a = new long[max]; nElems = 0; } public void insert(long value) { a[nElems] = value; nElems++; } public boolean find(long searchKey) { int j; for (j = 0; j < nElems; j++) if (a[j] == searchKey) break; if (j == nElems) return false; else return true; } public long getMax() { if (nElems == 0) return 01; else { long max = a[0]; for (int i = 1; i < nElems; i++) { if (a[i] > max) max = a[i]; } return max; } } public boolean delete(long value) { int j; for (j = 0; j < nElems; j++) if (value == a[j]) break; if (j == nElems) return false; else { for (int k = j; k < nElems; k++) a[k] = a[k + 1]; nElems--; return true; } } public void display() { for (int j = 0; j < nElems; j++) System.out.print(a[j] + " "); System.out.println(""); }} public class HighArrayApp { public static void main(String[] args) { int maxSize =…Here is my code in Java: import java.util.Scanner; import java.util.HashMap; public class Inventory { /** This class demonstrates the inventory */ //Declarations Of inventory static final int LightBulb60W = 1; static final int LightBulb100W = 2; static final int BoltM5 = 3; static final int BoltM8 = 4; static final int Hose25 = 5; static final int Hose50 = 6; public static void main (String [] args) { //Scanner Object @SuppressWarnings("resource") Scanner keyboard = new Scanner(System.in); //Variables int month; int day; int year; double units; double cost = 0; //Declarations int total; HashMap<Integer, String> productMap = new HashMap<>(); productMap.put(1,"Light Bulb 60W"); productMap.put(2,"Light Bulb 100W"); productMap.put(3,"Bolt M5"); productMap.put(4,"Bolt M8"); productMap.put(5,"Hose 25 feet"); productMap.put(6,"Hose 50 feet 60W"); while(true){ //Prints out inventory System.out.println("The Inventory: "); System.out.println("1…
- Public classTestMain { public static void main(String [ ] args) { Car myCar1, myCar2; Electric Car myElec1, myElec2; myCar1 = new Car( ); myCar2 = new Car("Ford", 1200, "Green"); myElec1 = new ElectricCar( ); myElec2 = new ElectricCar(15); } }In java can you help with parts that are missing Email- date: Date- subject: String- urgent: boolean+ Email(date:Date,urgent:boolean,subject:String)+ getDate(): Date+ setDate(date: Date): void+ getSubject(): String+ setSubject(subject:String): void+ isUrgent(): boolean+ setUrgent(urgent: boolean): void+ toString(): String public class Email { private Date date; private String subject; privatebooleanurgent; public Email() { } public Email(Date date, booleanurgent, String subject) { this.date = date; this.urgent = urgent; this.subject = subject; } public Date getDate() { returndate; } publicvoid setDate(Date date) { this.date = date; } public String getSubject() { returnsubject; } publicvoid setSubject(String subject) { this.subject = subject; } publicboolean isUrgent() { returnurgent; } publicvoid setUrgent(booleanurgent) { this.urgent = urgent; } @Override public String toString() { return"Email [date=" + date + ", subject=" + subject + ", urgent=" + urgent +…import java.awt.*; public class TestRectangle {public static void main(String[] args) {Rectangle r1 = new Rectangle(5, 4, 10, 17);Rectangle r2 = new Rectangle(10, 10, 20, 3);Rectangle r3 = new Rectangle(0, 1, 12, 15);Rectangle r4 = new Rectangle(10, 10, 20, 3);System.out.println("r1 = " + r1);System.out.println("r2 = " + r2);System.out.println("r3 = " + r3);System.out.println("r2 equals r1? " + r2.equals(r1));System.out.println("r2 equals r2? " + r2.equals(r2));System.out.println("r2 equals r3? " + r2.equals(r3));System.out.println("r2 equals r4? " + r2.equals(r4)); System.out.println("r1 contains (6, 8)? = " + r1.contains(6, 8));System.out.println("r2 contains (6, 8)? = " + r2.contains(6, 8));System.out.println("r3 contains (6, 8)? = " + r3.contains(6, 8));System.out.println("r2 contains (30, 13)? = " + r2.contains(30, 13)); r1.intersect(r3);r2.intersect(r4);System.out.println("r1 intersect r3 = " + r1);System.out.println("r2 intersect r4 = " + r2);…
- /** * A tester program for the PaintJob class. * public class PaintJobTester { public static void main(String[] args) { PaintJob job = new PaintJob(10.5, 9.0); System.out.printf("Room length: %.1f%n", job.getLength()); System.out.println("Expected: 10.5"); System.out.printf("Room width: %.1f%n", job.getWidth()); System.out.println("Expected: 9.0"); System.out.printf("Surface area: %.2f%n", job.surfaceArea()); System.out.println("Expected: 368.72"); System.out.printf("Paint cost: %.2f%n", job.costOfPaint()); System.out.println("Expected: 39.27"); System.out.printf("Total cost: %.2f%n", job.totalJobCost()); System.out.println("Expected: 139.27"); job.setDimensions(15, 12); System.out.printf("Room length: %.1f%n", job.getLength()); System.out.println("Expected: 15.0"); System.out.printf("Room width: %.1f%n", job.getWidth());…Implement the following method to move a pawn piece in chess: public class Pawn extends Piece { public Pawn(int x, int y, Side side, Board board) { super(x, y, side, board); } @Override public boolean canMove(int destX, int destY) { if((destX > 7 || destY > 7 ) || (destX < 0 ||destY < 0)) { return false; }else {JAVA Implement the equals method of the Arrow class. Two arrows are equal when they have the same starting point and direction. public class Arrow{ private Point start; private String direction; /** Constructs an arrow. @param x the x-position @param y the y-position @param direction a compass direction N E S W NE NW SE SW */ public Arrow(int x, int y, String direction) { start = new Point(); start.move(x, y); this.direction = direction; } /** Checks whether this arrow is equal to another. @param otherObject another arrow @return true if this arrow and otherObject have the same position and direction. */ public boolean equals(Object otherObject) { /* code goes here */ }}