Poblic class Has Errors Poblic static void mainO; n ain Sqstem.out. print (piease coter tuvo numbers:) X n.readDooble y : in. read Double,
Q: class Time { public: Time (int hours, int minutes); const Time operator-(const Time& rhs) const; //…
A: Code: // Initializationofstream OUT("out.txt");point p,m;p.x = p.y = m.x = m.y = 0; // Get moves…
Q: Java Constructor(String) This constructor will take a string of digits(no commas) and turn it into…
A: Actually, the answer has given below:
Q: class Moo{ public: int m; Moo (int v=-1){m=v;} }; class Foo { private: int x; protected: int y;…
A: Given The answer is given below output: 10 -1 4 6 ok 10 -1 6 12 ok 9 8
Q: Class Student A Student object represents a student. A student has a first name, middle name and…
A: you have to define both the method in the Class and then take input and return the output as a full…
Q: Write a recursive method that converts a decimal number intoa hex number as a string. The method…
A: Since you are not mentioning the programming language, here we are using Java language to complete…
Q: LabProgram.java Load default template... 1 import java.util.Scanner; 2 3 public class LabProgram {…
A: PROGRAM INTRODUCTION: Import the required header files. Start the definition of the main function.…
Q: class TestApp { static int index = 0; public static void main(String args[ ]) {…
A: non-static method test() cannot be referenced from a static context we get this compile time error
Q: class Excep { public static void main(String[] args){ try{ int arr[]=(1,2}; int x = arr[1]/arr[0]-1;…
A: Define class Excep. Define main function. Define try block. Define array arr with values 1 and 2.…
Q: public class IncrementDecrement { public static void main (String[] args) { int number = 50; int…
A: Given: Run the following code. Write its output and also explain the output
Q: class Fraction private int num, denom; public Fraction(int num, int denom) (/code elided"/> public…
A: A fraction is a ratio of two values. The fraction has the form a / b where a is called the…
Q: Using the concept of classes in object-oriented programming Write java project for Motor Company…
A: I give the code in java along with the output and code screenshot
Q: .is a block of code which only runs when it is called. - A classs integer method loop
A: According to the Question below the complete Solution:
Q: Please determine errors and correct it. package test; import java.util.Scanner; public class…
A: Following were the errors in the code: Here as we need to find the salary structure of the…
Q: 4 Identify errors if there is any & after identifying rewrite the code public class Employee (…
A:
Q: C# Write the definition for the Triangle class that works for the following main() method. public…
A: Program Approach: Using package System Using namespace Defining a class Defining double variable…
Q: Create a class named RecusiveMethod having a recursive method. The recursive method accepts an…
A: A JAVA program with a recursive method that prints the even numbers within the range should be…
Q: public class Account{ public double balance; public Account(double x){ balance = x; %3D } } public…
A: Answer: Create a separate module of class Account and Save the file as account.java package…
Q: Treating a base-class object as a(n)____________ can cause errors
A: Answer to the following question:-
Q: public class Question1 { public static void main(String[] args) { double val; int counter = 0; int…
A: public class Question1 { public static void main (String[]args) { double val; int…
Q: top nge public int findScore(int[]0 scores) { int r, c; int i, j = 0; for (r = 0; r j) j = i; }…
A: first j is initialized with 0 with the help of two for loops the code is iterating through all the…
Q: Fill in the blanks (...)C++ homework #include using namespace std; class Date { public: ….. void…
A: #include <iostream>using namespace std;class Date {public:int day;int month;int year; void…
Q: ublic class numClass { -ivate int a; -ivate static int y = 10; blic numClass(int newx) a=newx; }…
A: I have answered below:
Q: public static void main(String[] args) { // create two circle objects Circle circlel - new Circle();…
A: The complete Java code is as follows:
Q: class A{ protected: int x, y; public: int z; }; class B: private A{ private: int a, b, c; public:
A: a) B have 6 data members. They are x,y,z,a,b,c b) No data members are visible in B. c) x,y,z,a,b,c…
Q: #include using namespace std; class A { private: int x; public: A(int _x) { x = _x; } int…
A: There is one C++ code is given as following, #include <iostream>using namespace std;class A{…
Q: 10 public class Array { public static final int NUM_DAYS = 6; public static final double REV_PIZZA =…
A: From output of your code, it seems, there is no any syntax error, code gave output. But there is a…
Q: class Player { protected: string name; double weight; double height; public:…
A: Note: since your question contain multiple subparts but we can answer only 3sub-parts at a time…
Q: public class Class private static int private int public static void main(String) args) Class2 al…
A: Given that Java code using different classes.
Q: class A(int x;public: A(){x=0;}void set(int x1){x=x1;)int get0freturn xl}a1(10)
A: class A{int x; public:A() {x=0; } void set(int x1) { x=x1; }int get(){return x;}}a1(10) a. It has…
Q: //Fix the error class postcovid resultpositive() System.out.println("Result positive"); } void…
A: Errors The constructors of a class should have the same name as that of the class. Here, the…
Q: blic class Pickupwindow extends ConsoleProgram ublic void run() // Display menu String menu = "1.…
A: Answer: PickupWindow.java: import java.util.Scanner; public class PickupWindow { public static…
Q: public class Test { public static void main(String[] args) A a = new A(3); } } class A extends B {…
A: We have a java code we have to tell the output of program. Here we are using extends keyword, which…
Q: What is output? public class Vehicle { protected String vehicleName; public void setName(String…
A: Inheritance in Java is an OOP concept in which one class acquires all the properties and behaviors…
Q: This is a debugging question - The files provided in the code editor to the right contain syntax…
A: Given code: Errors: The semi colon is missing at the end of the statement at line number "5". The…
Q: (a) Find the errors in the following also explain what causes the error class Student int getid()…
A: In the above code, List of errors generated by code: 1. In class Student, static int…
Q: 1 public class MathF( public static void main(String[] args) 3 { char[] grade-new char[4]; 4…
A: Answer:
Q: class Emp{ class Test { private String name; public static void main(Stringl] args) public void…
A: /** * private attributes of class can only accessed by using public methods. * s.name = Ahmed *…
Q: ijava 23 3 public class Paintl { public static void main (String [] args) { Scanner scnr = new…
A: I have used try-catch statements to handle cases when user entered data other than double type (i.e…
Q: class implementation file -- Rectangle.cpp class Rectangle { #include #include "Rectangle.h" using…
A: Find the required code in C++ given as below and output :
Q: Part 1: Your classmate Yurtle has a sticky keyboard and sometimes he presses down on a letter key…
A: According to guidelines, we are only allowed to answer question at a time, please repost the…
Q: Fill in the blanks (...)C++ homework #include using namespace std; class Date { public: ….. void…
A: Please find the answer below
Q: public class Class1 ( private int i public Class1(int i0 System.out.printin("Class1:"+); public…
A: Answer: I have given answered in the brief explanation So correct answer is 4th option The program…
Q: Medium resistance: This class includes all resistances of values between 10 Q and 100 k Q. Most of…
A: Below is the complete solution and explanation to the given question in detail.
Q: PYTHON: This exercise is a variation on "instrumenting" the recursive Fibonacci program to better…
A: Code: class FibCounter: def __init__(self): self.counter = 0 def getCount(self):…
Q: public class Student { public static void main(String[] args) { String address = "Delhi, India";…
A: There is no error in the program. Given address="Delhi, India"
Q: public class circleDemo public dass Circle{ private int raduis; private int first; private static…
A: Circle one = new Circle(); It will create an object of class Circle and also initialize the…
Q: Exercise 3 (Resursive String Reversal) Create a class called StringReversal. Inside of it, create a…
A: Given:
What are the errors in the following code?
Trending now
This is a popular solution!
Step by step
Solved in 3 steps
- Please determine errors and correct it. package test; import java.util.Scanner; public class Test { public static void main(String[] args) {String fname,lname; int hrsworked; Double payrate,income,fnfp,paye,fiji,medical=6.50,total_deduction,netpay; Scanner sc = new Scanner(System.in); System.out.print("\nEnter Employee First Name: "); fname = sc.nextLine(); System.out.print("Enter Employee Last Name: "); lname = sc.nextLine(); System.out.println("Enter Employee Hours Worked: "); hrsworked = sc.nextInt(); System.out.print("Enter Employee Pay Rate: "); payrate = sc.nextDouble(); income = hrsworked * payrate; fnfp = income*0.085; paye = income*0.065; fiji = income*0.0285; total_deduction = hrsworked + fnfp + paye + fiji +medical; netpay = income-total_deduction; System.out.printf("\n*-------------* Pay Slip for: %s *-------------*\n",(fname+" "+lname)); System.out.printf("Fortnightly Income: $ %.2f\n",income); System.out.printf("Hours Worked: \n", hrsworked); System.out.printf("FNPF: $…public class RepeatStrings {public static void main(String[] argv) throws Exception{final int SIZE = 3;Scanner keyboard = new Scanner(System.in);QueueADT<String> stringQueue;//stringQueue = new CircularArrayQueue<String>(SIZE);stringQueue = new LinkedQueue<String>();StackADT<String> stringStack;stringStack = new ArrayStack<String>(SIZE);String line;for (int i = 0; i < SIZE; i++){System.out.print("Enter a line of text which includes only 3 words > ");line = keyboard.nextLine();//TODO enque the new element//TODO push the new element}System.out.println("\nOrder is: ");for (int i = 0; i < SIZE; i++){// TODO Remove an element in the order in which we input strings// Save it to the String variable, named lineSystem.out.println(line);}System.out.println("\nOpposite order is: ");for (int i = 0; i < SIZE; i++){// TODO Remove an element in the order opposite to they were entered// Save it to the String variable, named lineSystem.out.println(line);}}}Code: import java.util.Scanner;public class ReceiptMaker { public static final String SENTINEL = "checkout";public final int MAX_NUM_ITEMS;public final int TAX_RATE;private String itemNames;private double [] itemPrices;private int numItemsPurchased; public ReceiptMaker(){MAX_NUM_ITEMS = 10;TAX_RATE = .0875; itemNames = new String[MAX_NUM_ITEMS];itemPrices = new double[MIN_NUM_ITEMS];numItemsPurchased = 0;}public ReceiptMaker(int maxNumItems, double taxRate){if(isValid(maxNumItems)){MAX_NUM_ITEMS = maxNumItems;}else{MAX_NUM_ITEMS= 10;}if(isValid(taxRate)){TAX_RATE = taxRate;}else{TAX_RATE = .0875;}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 ""+SENTINEL+"\" to end transaction…
- See ERROR in Java file 2: Java file 1: import java.util.Random;import java.util.Scanner; public class Account {// Declare the variablesprivate String customerName;private String accountNumber;private double balance;private int type;private static int numObjects;// constructorpublic Account(String customerName, double balance, int type) { this.customerName = customerName;this.balance = balance;this.type = type;setaccountNumber(); // set account number functionnumObjects += 1;}private void setaccountNumber() // definition of set account number{Random rand = new Random();accountNumber = customerName.substring(0, 3).toUpperCase();accountNumber += type;accountNumber += "#";accountNumber += (rand.nextInt(100) + 100);}// function to makedepositvoid makeDeposit(double amount){if (amount > 0){balance += amount;}}// function for withdrawboolean makeWithdrawal(double amount) {if (amount < balance)balance -= amount;elsereturn false;return true;}public String toString(){return accountNumber +…Given the previous Car class, the following members have been added for you: Private: string * parts; //string array of part names int num_parts; //number of parts Public: void setParts(int numpart, string newparts[]) //set the numparts and parts int getNumParts() string * getParts() string getPart(int index) //return the string in parts at index num Please implement the following for the Car class: Add the copy constructor. (deep copy!) Add the copy assignment operator. (deep copy!) Add the destructorThere is an ERROR in this code: import java.util.Scanner; public class TestPhoneBook { public static String lookupName(String targetName, PhoneBook[]anArray){String targetPhoneNumber="";boolean result=false;for (int idx = 0; idx<anArray.length && !result; idx++) { if(anArray[idx].getName().equalsIgnoreCase(targetName)){ ERRORtargetPhoneNumber = anArray[idx].getPhoneNumber(); result=true;} public static void main(String args[]) { ERRORScanner kbd = new Scanner(System.in);PhoneBook[]arrObj = new PhoneBook[3];arrObj[0]= new PhoneBook("John Ficks", "657-9875");arrObj[1]= new PhoneBook("Howard Williams", "908-1001");arrObj[2]= new PhoneBook("George Clemens", "808-5001");System.out.println("Enter name to look up");String targetName = kbd.nextLine(); String targetPhone = lookupName(targetName, arrObj);System.out.println("The phone number is "+targetPhone);}} jAVA 2 CODE: package PhoneBook; public class PhoneBook {String name;String phone_number;PhoneBook(String newName,…
- The following code has numerous errors that need to be fixed. import java.util.Scanner;public class LabProgram {public static int calcNumCharacters(String userString, char userChar) {int i;int numChars;i = ;numChars = ;while (i < userString.length() {if (userString.charAt(i) == userChar) {++numchars;++i;}retrn numChars;}public static void main(String[] args) {Scanner scnr = new Scanner(System.in);inputChar;inputString;numChars;inputChar = scnr.next().charAt(0);inputString = scnr.nextLine();numChars = calcnumCharacters(inputString, inputChar);System.out.print(numChars);System.out.print(" " + inputChar);if (numChars != 1) {System.out.print("'s");}System.out.println(); }class Player { protected: string name; double weight; double height; public: Player(string n, double w, double h) { name = n; weight = w; height = h; } string getName() const { return name; } virtual void printStats() const = 0; }; class BasketballPlayer : public Player { private: int fieldgoals; int attempts; public: BasketballPlayer(string n, double w, double h, int fg, int a) : Player(n, w, h) { fieldgoals = fg; attempts = a; } void printStats() const { cout << name << endl; cout << "Weight: " << weight; cout << " Height: " << height << endl; cout << "FG: " << fieldgoals; cout << " attempts: " << attempts; cout << " Pct: " << (double) fieldgoals / attempts << endl; } }; a. What does = 0 after function printStats() do? b. Would the following line in main() compile: Player p; -- why or why not? c. Could…Following programs contain syntax/logical errors. Underline the error and explain precisely the cause of the error to get any credit. Just underlining will not be given credit. [2.5x2=5] i. interface P{ void fun(int x) ; } ------------------------ class S implements P{ public void funny(){ System.out.print(“OOP is funny”); } public static void main(String args[]){ S s1 = new S(); s1.funny() } } ii. public class A{ int x; void A(int x) { this.x=x; System.out.println("in Class A"); } public static void main(String[] args){ new A(5); }
- PYTHON PROGRAMMING CODE: class Dog:def __init__(self, name, breed, age):self.name = nameself.breed = breedself.age = agedef sit(self):print(self.name.title() + " is now sitting")def roll(self):print(self.name.title() + " rolled over")def bark(self, times):print(self.name, 'says woof ', times, ' times.')dog1 = Dog("bantay", 'aspin', 4)print(dog1.name)print(dog1.breed)print(dog1.age)[Easy] class Trace: def hMB(self,h): if (h==0): print("Stop: ",h) return 0 elif(h==1): print("Stop: ",h) return h else: print("Continue: ",h) return h + self.hMB(h-1) #Tester t = Trace() print("Finally ",t.hMB(5))Java Language Please help me fix all the error. I very appreciate it Coding: import java.util.Scanner;public class Main { /*static displayline(); char line; { for (int i = 1; i < line; i++ ) { System.out.println ("_"); } } */ public static void main(String[] args) { System.out.println("Clinic Management\n"); int PatAge, Pnumber,age; int cmedicine, cost, Pcost, total, newTotal; String PatName, Pgender, Pdisease, Pmedicine; char typeofmedicine; Scanner scan = new Scanner(System.in); System.out.println("Patient Name :"); String name = scan.next(); name = name + scan.nextLine(); System.out.println("Patient Age :"); age = scan.nextInt(); System.out.println("Patient Gender :"); String gender = scan.next(); System.out.println("Patient Phone Number :"); Pnumber = scan.nextInt(); System.out.println("Patient Disease :" ); String disease =…