IN JAVA What is output? Item jar = new Item(); Item ball = new Item(); System.out.println(Item.count); public class Item{ public static int count = 1; public Item(){ count++; } }
Q: public class PrintPrimes { private static boolean isDivisible (int i, int j) { if (j%i == 0) return…
A: The provided Java code is a program that prints prime numbers up to a given number. The questions…
Q: C# Programming What is the wrong of this code? Can you fix the error on this part? See attached…
A: Error message #1 This error means that the IEnumerable type does not contain the Capacity property…
Q: 1. Place all the Menus in separate Methods. 2. Place computations in separate Methods and call the…
A: In cases where the question has multiple questions, we are needed to solve only one. We have here…
Q: public class A { private int x; public static int count1 = 0; public int count2 = 0; public A (int…
A: Object-oriented programming (OOP) is a programming paradigm where code is organized into objects,…
Q: PROBLEM STATEMENT: Return a number divided by 2. public class DivideByTwo{ public static double…
A: Required: PROBLEM STATEMENT: Return a number divided by 2. Can you help me solve this question The…
Q: #include Servo servo; int const trigPin = 9; int const echoPin = 8; #define red 5 #define green 6…
A: Below is the complete solution with explanation in detail for the given question about the flowchart…
Q: class Main { public static void main(String[] args) { String fox = "brown"; String frog = "jumps";…
A: let's find the output of given java code: first start with print function , then inside it whatever…
Q: PROBLEM STATEMENT: Return a number divided by 2. public class DivideByTwo{ public static double…
A: GIVEN: PROBLEM STATEMENT: Return a number divided by 2. public class DivideByTwo{public static…
Q: // simulates a simple vending machine with operations to pur
A: The given coding practice requires you to create a VendingMachine object and perform operations…
Q: using System;public static class Lab3_2{public static void Main(){// declare the variables and…
A: Remove the syntax error from the given C# code and run it for input weight 2. About the given code:…
Q: COMPILER ERROR MESSAGES Driver.java:4: error: class TriangleDriver is public, should be declared in…
A: - We need to highlight and correct the problem described in the picture above.
Q: * Author: Omar Yousef Date: 02/10/2022 A program that outputs a bank account */ public class…
A: Errors in the above program: There should be sapce between each token in the Java program.…
Q: Draw code control flow graph and and calculate the LOC of the code in the picture.
A: import java.util.*; import java.MyClass; //ignore errors public class Main{ public…
Q: Sara is writing a program to input her monthly phone bills and output the month name and amount for…
A: Input bills for 12 months from user Then, iterate over array and check if it is maximum or not We…
Q: import java.util.Scanner; public class sample { public static double totalProfit = 0.00; public…
A: A diagram that depicts a workflow or process is called a flowchart. Another definition of a…
Q: public class NumbersDemo { public static void displayTwiceTheNumber(int number){…
A: Below is the complete solution with explanation in detail for the given question in Java Programming…
Q: amount the same, y, n, why? public class CheckingAct { private String actNum;…
A: 1. If you declare any variable in the methods then they are local variable and scope of variable is…
Q: JAVA Language Caesar Shift Question: Modify the Caesar class so that it will allow various…
A: Algorithm: Caesar Cipher1. Create an abstract class called Cipher. a. Define an abstract method…
Q: 3. a Given the following code: public class Test { public static void main (String [] args) { Object…
A: ********************** Explaination of the code ************************* In the first part and in…
Q: class Test { private int a; private int b; public Test() { a = 5; b = a - 3; }…
A: The above code contains no error. The program conatins a class named Test with two data members.…
Q: /* TestCarSensor.java - program to test the CarSensor class. */ public class TestCarSensor { public…
A: Errors in CarSensor.java: The class had below errors: Data type was missing for data member: error,…
Q: Fix this program import java.util.Scanner; public class main { public static void…
A: All the errors are fixed in the code The correct code is given below with OUTPUT screenshot Happy to…
Q: t the corners of a panel.
A: In this program the student asks us to add more designs like background images, font style, font…
Q: In C++ QUESTION 14 class rectangleType { public: void setLengthWidth(double x, double y);…
A: In order to write and test the function definition of perimeter we also need to write the function…
Q: The Student Painters company paints dorm rooms. The rooms have one window and one door. The room is…
A: For the given problem, below is the Java code.
Q: preLabC.java U 1 import java.util. Random; 2 3 4 public class preLabC { 5 6- 7 8 9 10 11 12 13 14…
A: Algorithm:Define a method called myMethod that takes a MathVector object as input.Define a method…
Q: Neight(lb): " + shipWeightPounds); lat foofconte)" ELAT EEE CENTS). w. Special character legend…
A: I have answered below:
Q: public class CallStack{ // Called by func1() void func2 (){ System.out.println("In…
A: According to the information given:- We have to examine the code and handle the exception by…
Q: } class ChoiceQuestion public Question { public: ChoiceQuestion(); void set_text(string new_text);…
A: In object-oriented programming (OOP), the idea of function overriding is used when a subclass offers…
Q: public elass Sale public static void nain(String(] arga) int price, tax, total: price- 29 tax 1;…
A: public class Sale{ public static void main(String[] args) { int price, tax, total;…
Q: This lab will demonstrate how the toString() and equals() methods work when they a not overridden.…
A: for tostring()
Q: #include using namespace std; class fraction{ float d,s; public: fraction() { d30; s=13; }…
A:
Q: An anagram is a word that has been rearranged from another word, check to see if the second word is…
A: output
Q: Class counter { Int Count=22; Puplic:
A: In this answer I will be discussing the code.
Q: Complete the seperateDuplicateChars() method in SeperateDuplicates.java as follows: - The method…
A: Here's the implementation for seperateDuplicatesChars() method: CODE: public static String…
Q: CREATE A FLOWCHART. Creating a Class in C++ // Rectangle.cpp using namespace std; class Rectangle {…
A: Find the flow chart and output given as below :
Q: Two considerations encourage multilayer protocols
A: Two considerations that encourage the use of multilayer protocols are:
Q: public static void main(String[] args) { // create two circle objects Circle circlel - new Circle();…
A: The complete Java code is as follows:
Q: public class KnowledgeCheckTrek { public static final String TNG = "The Next Generation";…
A: We need to find the correct option regarding the given Java code.
Q: package go; package demo; public class Pokemon { import L; // import Pokemon class (#1) private int…
A: Please refer to the following step for the complete solution of the problem above.
Q: QUESTION 21 Given a class definition as: class ColorTrackingRobot { private: string RGBColor; float…
A: The given code is not correct
Q: what is wrong with my code I need help pls make it in the correct format and explain what is wrong…
A: import java.util.Scanner; public class Movie { private String name; private double rating;…
Q: Class counter { Puplic: Int Count-10; counter():Count(
A: The given is a c++ code where class counter is implemented having a main method that it trying to…
Q: Predicting the output(Predict the output of the given program) public class MidTerm { public…
A: Here we have given step by step representation for the execution of program with comments.
Q: public class Test1 { private static int index = 0; public int x; Test1(){ index ++; } public static…
A: Encapsulation is an object oriented programming concept which is to provide more security for the…
Q: Write a program that takes in three integers as inputs and outputs the largest value. Use a try…
A: The provided program aims to read up to three integer inputs from the user and output the largest of…
IN JAVA
What is output?
Item ball = new Item();
System.out.println(Item.count);
public static int count = 1;
public Item(){
count++;
}
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- import java.util.*; class Money { private int dollar; private int cent; final static int MIN_CENT_VALUE = 0; final static int MAX_CENT_VALUE = 99; public Money() { this.dollar = 0; this.cent = 0; } public Money(int dollar, int cent) { this.dollar = dollar; if (cent > MIN_CENT_VALUE && cent <= MAX_CENT_VALUE) { this.cent = cent; } else { cent = 0; } } public int getDollar() { return this.dollar; } public void setDollar(int dol) { this.dollar = dol; } public int getCent() { return this.cent; } public void setCent(int c) { if (c >= MIN_CENT_VALUE && c <= MAX_CENT_VALUE) { this.cent = c; } } public Money add(Money otherMoney) { Money m = new Money(); m.dollar = this.dollar + otherMoney.dollar; m.cent = this.cent + otherMoney.cent; if (m.cent >= 100) {…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 savedHow do I fix the errors? Code: import java.util.Scanner;public class ReceiptMaker { public static final String SENTINEL = "checkout";public final int MAX_NUM_ITEMS;public final double TAX_RATE;private String[] itemNames;private double[] itemPrices;private int numItemsPurchased; public ReceiptMaker() {MAX_NUM_ITEMS = 10;TAX_RATE = 0.0875;itemNames = new String[MAX_NUM_ITEMS];itemPrices = new double[MAX_NUM_ITEMS];numItemsPurchased = 0;}public ReceiptMaker(int maxNumItems, double taxRate) {MAX_NUM_ITEMS = maxNumItems;TAX_RATE = taxRate;itemNames = new String[MAX_NUM_ITEMS];itemPrices = new double[MAX_NUM_ITEMS];numItemsPurchased = 0;} public void greetUser() {System.out.println("Welcome to the " + MAX_NUM_ITEMS + " items or less checkout line");}public void promptUserForProductEntry() {System.out.println("Enter item #" + (numItemsPurchased + 1) + "'s name and price separated by a space, or enter \"checkout\" to end transaction early");}public void addNextPurchaseItemFromUser(String…
- public class Side Plot { * public static String PLOT_CHAR = "*"; public static void main(String[] args) { plotxSquared (-6,6); * plotNegXSquaredPlus20 (-5,5); plotAbsXplus1 (-4,4); plotSinWave (-9,9); public static void plotXSquared (int minX, int maxx) { System.out.println("Sideways Plot"); System.out.println("y = x*x where + minX + "= minX; row--) { for (int col = 0; col row * row; col++) { System.out.print (PLOT_CHAR); if (row== 0){ } System.out.print(" "); } for(int i = 0; i <= maxx* maxX; i++) { System.out.print("-"); } System.out.println(); Sideways PHOT y = x*x where -6<=x<=6 Sideways Plot y = x*x where -6<=x<=6 How do I fix my code to get a plot like 3rd picture?Java Program What is the output of this problemusing System;public static class Lab3_2{public static void Main(){// declare the variables and constantsconst double FLAT = 1.25;double weight;double cost, pricePerKg = 0;// Input the weightConsole.Write("Enter a positive weight of the package => ");weight = Convert.ToDouble(Console.ReadLine());// Determine the cost per kilogramif (weight <= 0)Console.WriteLine("*** Invalid weight");else if (weight < 1)pricePerKg = 0.25;else if (weight <= 3.5)pricePerKg = 0.5;else (weight > 3.5)pricePerKg = 1.0;// Compute the cost to send the packageif (weight > 0)cost = weight * pricePerKg + FLAT;elsecost = 0;// Output the resultsConsole.WriteLine("The cost to send the package is {0:C}",cost);Console.ReadLine();}} Remove the error from the given program and run it for input weight 2.5.
- public class Main5 1 public static void main(String[] args) { inta= butjwant 0 833 please help me i am begineer ir avaJava true or false: The method public boolean simpleMethod() { return true; } is a valid mutator?// This class discounts prices by 10% public class DebugFour4 { public static void main(String args[]) { final double DISCOUNT_RATE = 0.90; int price = 100; double price2 = 100.00; tenPercentOff(price DISCOUNT_RATE); tenPercentOff(price2 DISCOUNT_RATE); } public static void tenPercentOff(int p, final double DISCOUNT_RATE) { double newPrice = p * DISCOUNT_RATE; System.out.println("Ten percent off " + p); System.out.println(" New price is " + newPrice); } public static void tenPercentOff(double p, final double DISCOUNT_RATE) { double newPrice = p * DISCOUNT_RATE; System.out.println"Ten percent off " + p); System.out.println(" New price is " + newprice); } }
- 8) Now use the Rectangle class to complete the following tasks: - Create another object of the Rectangle class named box2 with a width of 100 and height of 50. Note that we are not specifying the x and y position for this Rectangle object. Hint: look at the different constructors) Display the properties of box2 (same as step 7 above). - Call the proper method to move box1 to a new location with x of 20, and y of 20. Call the proper method to change box2's dimension to have a width of 50 and a height of 30. Display the properties of box1 and box2. - Call the proper method to find the smallest intersection of box1 and box2 and store it in reference variable box3. - Calculate and display the area of box3. Hint: call proper methods to get the values of width and height of box3 before calculating the area. Display the properties of box3. 9) Sample output of the program is as follow: Output - 1213 Module2 (run) x run: box1: java.awt. Rectangle [x=10, y=10,width=40,height=30] box2: java.awt.…In C# using System; using static System.Console; using System.Globalization; class JobDemo4 { static void Main() { RushJob[] jobs = new RushJob[5]; int x, y; double grandTotal = 0; bool goodNum; for(x = 0 ; x < jobs.Length; ++x) { jobs[x] = new RushJob(); Write("Enter job number "); jobs[x].JobNumber = Convert.ToInt32(ReadLine()); goodNum = true; for(y = 0; y < x; ++y) { if(jobs[x].Equals(jobs[y])) goodNum = false; } while(!goodNum) { Write("Sorry, the job number " + jobs[x].JobNumber + " is a duplicate. " + "\nPlease reenter "); jobs[x].JobNumber = Convert.ToInt32(ReadLine()); goodNum = true; for(y = 0; y < x; ++y) { if(jobs[x].Equals(jobs[y])) goodNum = false; } }…Here is the class MyBookShelfTester public class MyBookShelfTester {public static void main(String[] args) {MyBookShelf bookShelf = new MyBookShelf(); Book book1 = new Book("Diaspora", "Greg Egan");Book book2 = new Book("What if?", "Randall Munroe");Book book3 = new Book("Foundation", "Isaac Asimov");Book book4 = new Book("Solaris", "Stanislaw Lem");Book book5 = new Book("The Hitchhiker's Guide to the Galaxy", "Douglas Adams"); bookShelf.addCount(book1);bookShelf.addBook(book2);bookShelf.addBook(book3);bookShelf.addBook(book4);bookShelf.addBook(book5); book1.addRating(5);book1.addRating(5);book1.addRating(4);book1.addRating(4); book5.addRating(5);book5.addRating(5);book5.addRating(4); book4.addRating(5);book4.addRating(5); book1.checkOut();book2.checkOut();book3.checkOut();book4.checkOut();book5.checkOut(); book1.returnToLibrary();book2.returnToLibrary();book3.returnToLibrary();book4.returnToLibrary();book5.returnToLibrary(); Book diaspora = bookShelf.getBookByTitle("Diaspora");Book…