COMPILER ERROR MESSAGES Driver.java:4: error: class TriangleDriver is public, should be declared in a file named TriangleDriver.java public class TriangleDriver 1 error 1 import java.util.*; 2 3 //Driver for Triangle class 4 public class TriangleDriver 5 { //main method public static void main(String args[]) { //scanner object Scanner ob=new Scanner (System.in); 7 8 9 10 11 //variables to store the sides of triangle double sidel,side2,side3; 12 13 14 15 //getting the sides of the triangle System.out.print("Enter sidel of triangle: "); side1=ob.nextDouble (); 16 17 18 19 System.out.print("Enter side2 of triangle: "); side2=ob.nextDouble(); 20 21 22 System.out.print("Enter side3 of triangle: "); side3=ob.nextDouble (); 23 24 25 //getting the color of the triangle System.out.print("Enter color of triangle: "); String color=ob.next(); 26 27 28 29 //getting filled or not System.out.print("Enter whether triangle is filled(yes/no): "); String choice=ob.next(); 30 31 32
Q: Java code; object oriented program; private static void Togrid(source s) { grid g1 = new…
A: According to the given, it is clear that Source class has a method named addObject. The addObject()…
Q: Main program file: public class BankAccountMainProgram { public static void main(String[]…
A: Step 1:- Class is defined as a collection of data member and member function that is enclosed into a…
Q: Design an interface named Encryptor that has a single (abstract) method named encrypt with one…
A: public interface Encryptor { public String encrypt(String plainText); } public class…
Q: Instructions Reverse4.cs + 1 using static System.Console; 2 class Reverse4 Create a new program 3 {…
A: The reverse is a methodology which is used to reverse the characters in the stringbuffer.
Q: (Classes and Objects) Hand-write a complete Java class that can be used to create a Car object as…
A: Instance variable in private scope. Using this pointer within default constructor with no arguments.…
Q: import java.util.*; public class USE11D { public static void main (String[] args) { Scanner sc = new…
A: According to the provided information: We need to find out the problem in driver class.
Q: Code: interface Bicycle{ //interface for bicycle void changeGear(int val); //abstract…
A: Solution is given below-
Q: Java Language Please help me fix all the error. I very appreciate it Coding: import…
A: Error free JAVA Code: import java.util.Scanner;public class Patient { /*static displayline();…
Q: Class Die java.lang.Object extended by Die public class Die extends java.lang.Object Die - an…
A: public class Main{ public static void main(String[] args) { Die d1=new Die(); //creates Die…
Q: Instructions InchConversion.java 1 import java.util.Scanner; 2 public class InchConversion { public…
A: Actually, Java is a high level programming language. And also object oriented . It. Is a platform…
Q: import java.util.Scanner; / import Scanner class required to accept input from user class Employee//…
A: import java.util.Scanner;// here we are importing the scanner to collect input from the consoleclass…
Q: If a recursive method does not have a stop case, what will happen ? System stops the program…
A: Option c is correct; An infinite loop will occur
Q: User-Defined Classes: In Java, Design and implement the class Day thst implrmntd the dsy of the week…
A: Hey there, I am writing the required solution based on the above given question. Please do find the…
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: CODE IN JAVA 2. Exploring Variable Length Parameter Lists The file Parameters.java contains a…
A: Answer is given below-
Q: Rectangle.java /** * Models a rectangle with a width and length. */ 4 public class Rectangle { //…
A: The class Rectangle has following definition: Data members (private): length of type double width…
Q: nstructions: Implement the Java class Customer by following the UML class diagram provided below.…
A: All the members variables are made private.Getters and setters can be used to get and set value of…
Q: public class Appliance { public int getVoltage() { return 10; } Appliance.java public interface…
A:
Q: at has following methods: sum, multiply, divide , modulus , sin , cos , tan
A: JAVA code Create a Calculator class that has following methods: sum, multiply, divide , modulus ,…
Q: Ex. If the input is: 4 plates 100 spoons 200 cups 150 forks 200 the output is: 200 forks…
A: Actually, the code has given beneath:
Q: Main program file: public class BankAccountMainProgram { public static void main(String[]…
A: The given Bank Account Main Program is: public class BankAccountMainProgram{ public static void…
Q: 1- Based on the UML shown below, Implement in Java the following inheritance hierarchy (the classes'…
A:
Q: eSenior = 3; } Answer these questions according to the UML class schema and the code given above.…
A: [JAVA] public class FlightRules {public final static int minHostessCount = 2;public final static int…
Q: Shape Class JAVA Implement the Shape hierarchy shown in figure below. Shape TwoDimensionalShape…
A: Code: ShapeTest.java: public class ShapeTest { public static void main(String[] args) { Shape[]…
Q: import java.util.Scanner; public class Main { public static void main(String[] args) {…
A: Here we hаve сreаted а Bаnk Ассоunt Аррliсаtiоn thаt will аllоw users tо dо their…
Q: In C++ class rectangleType { public: void setLengthWidth(double x, double y); //Sets the…
A: The problem is based on the basics of classes in C++ programming language.
Q: .e., “cnic” of type integer and “name” of type String, and a setter and getter method of type void…
A: EXPLANATION Whenever an object is created of a class, memory is allocated to that object in heap.…
Q: GuitarString.java Create a data type to model a vibrating guitar string. Write a class named…
A: In computer science the data type is an attribute of data that tells the compiler or interpreter how…
Q: 1. Create a class Doll with one attribute name of type String. Include set for attribute name. Doll…
A: class Doll: package bartleby; public class Doll { private String name; public Doll() { name=""; }…
Q: Write the Circle class:• A Circle has a radius– Add instance variable– 2 constructors – one should…
A: Create a class Circle and define it's instance variable as private type and just declare default…
Q: GuitarString.java Create a data type to model a vibrating guitar string. Write a class named…
A: import java.util.*;import java.lang.*;import java.io.*; class GuitarString{ Queue<Double>…
Q: In Python write an address book program using object oriented design, you would need at least two…
A: Dear Student, The Code as asked by you is given below, if you have any doubt please ask again…
Q: PLEASE REWIRETE THIS CODE USING "The J Option Pane Class" import…
A: The JOption Pane class is used to provide standard dialog boxes such as message dialog box, confirm…
Q: package main2; import java.util.Scanner; Elpublic class main2 { 8 public static void main(String[]…
A: We need to convert the given code to python or Ruby or c sharp. We are converting this to python.
Q: mport java.util.Scanner; public class TowerOfHanoi { /** * Main class */…
A: tower of hanoi is a puzzle problem. It consists of a number of disks and three rods. The aim of the…
Q: APEX Test Class - Salesforce Please Desgin the Apex Test Class to solve the below problem…
A: Given: Please Desgin the Apex Test Class to solve the below problem public with sharing class…
Q: Read the following main class. Try to guess what will be its output. class Test { public static…
A: The output of the program is as follows: I am in Main thread.
Q: Inheritance, Polymorphism, ArrayLists, Throwing Exceptions The UML diagram below shows a set of…
A: The ask is to implement the given UML diagram in Java.
Q: Support computing sales tax in the CashRegister class. The tax rate should be supplied when…
A: Note: you have not provided CashRegisterTester.java class file. so, we cannot provide compiled code…
Q: Tape for a Turing Machine (Doubly-linked List)”. JAVA A class named Tape to represent Turing machine…
A: Solution : Here is the required code : class Cell { public char content; // The character in this…
Q: tumLeft and turn Right methods that change the direction of the robot but not the location move…
A: public class Robot{ //declaring instance variables private String name; private int xPos; private…
Q: 3 4 public class OddNumbers // STATIC MAIN METHOD public static void main(String[] args) 8 10 //…
A: Here we would need a nested loop to traverse through the 2D array.
Q: Write all the code within the main method in the TestTruck class below. Implement the following…
A: import java.lang.IllegalArgumentException; public class TestTruck { public static void…
Q: Java program * Interfaces 1. Modify the class Rectangle to implement the Comparable interface, as…
A: public class Rectangle implements Comparable<Rectangle>{ double width=1; double height=1;…
Q: import java.util.Scanner; // import Scanner class required to accept input from user class…
A: As you asked only for the explanation of the code and especially the scanner class, array, and the…
Q: How do I fix the error Java? ReceiptMaker.java:6: error: invalid method declaration; return type…
A: Note: your given contain does not contain any ItemClass(String name, double price) method. If…
Q: i want to add the givens in the code last questions green to explain and answe
A: Program Approach: 1- Exception handling is used to handle the exception.2- Inside the book class…
Q: Write two Java classes: Student and Main as follow: Class Student: A. Create three private…
A: (1)First we need to define a Student class with the attributes Name, ID and Specialization (2)In…
Q: n computer programming: java Create a rectangle class that can compute the area and the sum of its…
A: Below is the required java program.Program Approach: Import scanner package to get the input from a…
Q: 1- Based on the UML shown below, Implement in Java the following inheritance hierarchy (the classes…
A: OOP or Object-Oriented Programming is a software model that is designed around data or objects…
fix that problem please.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- Write all the code within the main method in the Test Truck class below. Implement the following functionality. a) Constructs two truck objects: one with any make and model you choose and the second object with gas tank capacity 10. b) If an exception occurs, print the stack trace. c) Prints both truck objects that were constructed. import java.lang.IllegalArgumentException ; public class TestTruck { public static void main ( String [] args ) { heres the truck class information A Truck can be described as having a make (string), model (string), gas tank capacity (double), and whether it has a manual transmission (or not). Include the following methods in your class definition. . An overloaded constructor which takes the make and model. This method throws an IllegalArgumentException if the make is "Jeep". An overloaded constructor which takes the gas tank capacity. This method throws an IllegalArgumentException if the capacity of the gas…PLZ help with the following: True/False In java it is possible to throw an exception, catch it, then re-throw that same exception if it is desired GUIs are windowing interfaces that handle user input and output. An interface can contain defined constants as well as method headings or instead of method headings. When a recursive call is encountered, computation is temporarily suspended; all of the information needed to continue the computation is saved and the recursive call is evaluated. Can you have a static method in a nonstatic inner class?JAVA Language Caesar Shift Question: Modify the Caesar class so that it will allow various sized shifts to be used, instead of just a shift of size 3. (Hint: Use an instance variable in the Caesar class to represent the shift, add a constructor to set it, and change the encode method to use it.) import java.util.*; public class TestCipher { public static void main(String[] args) { int shift = 7; Caesar caesar = new Caesar(); String text = "hello world"; String encryptTxt = caesar.encrypt(text); System.out.println(text + " encrypted with shift " + shift + " is " + encryptTxt); } } abstract class Cipher { public String encrypt(String s) { StringBuffer result = new StringBuffer(""); // Use a StringBuffer StringTokenizer words = new StringTokenizer(s); // Break s into its words while (words.hasMoreTokens()) { // For each word in s…
- In C++ class rectangleType { public: void setLengthWidth(double x, double y); //Sets the length = x; width = y; void print() const; //Output length and width double area(); //Calculate and return the area of the rectangle (length*width) double perimeter(); //Calculate and return the perimeter (length of outside boundary of the rectangle) private: double length; double width; }; Declare an instance of rectangleType.in java create a class shopping mall. It has Items with name, manufacturer and price. Provide constructors. Getters, setters, toString methods. We add several items to Store. For that create a store class having name and array of items, Provide Constructors, getters/setters and toString(), in addition you have to provide a method add which add new item to the array. The main function that does these things looks as follows: Public static void main(Strings[] args) { Item shampoo2(“pantene”, “Procter & Gamble”,100), noodles(“Noodles”, “knorr”, 50); // add further items. Store abcSuperStore; abcSuperStore.add(shampoo2); abcSuperStore.add(noodles); … abcSuperStore.sale(shampoo2); a bcSuperStore.sale(noodles);public class OfferedCourse extends Course { // TODO: Declare private fields // TODO: Define mutator methods - // setInstructorName(), setLocation(), setClassTime() // TODO: Define accessor methods - // getInstructorName(), getLocation(), getClassTime() } import java.util.Scanner; public class CourseInformation { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); Course myCourse = new Course(); OfferedCourse myOfferedCourse = new OfferedCourse(); String courseNumber, courseTitle; String oCourseNumber, oCourseTitle, instructorName, location, classTime; courseNumber = scnr.nextLine(); courseTitle = scnr.nextLine(); oCourseNumber = scnr.nextLine(); oCourseTitle = scnr.nextLine(); instructorName = scnr.nextLine(); location = scnr.nextLine(); classTime = scnr.nextLine(); myCourse.setCourseNumber(courseNumber); myCourse.setCourseTitle(courseTitle);…
- in java create a class shopping mall. It has Items with name, manufacturer and price. Provide constructors. Getters, setters, toString methods. We add several items to Store. For that create a store class having name and object array of items, Provide Constructors, getters/setters and toString(), in addition you have to provide a method add which add new item to the array. The main function that does these things looks as follows: Public static void main(Strings[] args) { Item shampoo2(“pantene”, “Procter & Gamble”,100), noodles(“Noodles”, “knorr”, 50); // add further items. Store abcSuperStore; abcSuperStore.add(shampoo2); abcSuperStore.add(noodles); … abcSuperStore.sale(shampoo2); a bcSuperStore.sale(noodles);add override display methodusing System; //base classclass Book{//data membersprivate string title;private string author;protected double price;//constructorpublic Book(string t, string a){title = t;author = a;price = 500;}//method to display detailspublic void display(){Console.WriteLine("Title:" + title + " author:" + author + " price:" + price);}} //child classclass PopularBooks : Book {//constructorpublic PopularBooks(string t, string a) :base(t,a) {price = 50000;}} class Program {static void Main() {//an array of 5 objectsBook[] B = new Book[5];//input title and authorfor(int i=0; i<5;i++){Console.Write("Input title: ");string name = Console.ReadLine();Console.Write("Input author name: ");string author = Console.ReadLine();//if author is popular,//call constructor of sub classif (author.Equals("Khaled Hosseini") || author.Equals("Oscar Wilde") || author.Equals("Rembrandt")){B[i] = new PopularBooks(name, author);}//call base class constructorelse B[i] = new Book(name,…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 =…
- import java.util.Scanner; /**This program demonstrates a solution to thePayroll Class programming challenge.*/ public class PayrollDemo{ public static void main(String[] args) { // Variables for input String name; // An employee's name int id; // An employee's ID number double payRate; // An employee's pay rate double hoursWorked; // The number of hours worked // Create a Scanner object for keyboard input. Scanner keyboard = new Scanner(System.in); // Get the employee's name. System.out.print("Enter the employee's name: "); name = keyboard.nextLine(); // Get the employee's ID number. System.out.print("Enter the employee's ID number: "); id = keyboard.nextInt(); // Get the employee's pay rate. System.out.print("Enter the employee's hourly pay rate: "); payRate = keyboard.nextDouble(); // Get the number of hours worked by the employee.…Java Constructor(String) This constructor will take a string of digits(no commas) and turn it into an UnboundedInt object (MUST BE STRING INPUT) UnboundedInt add (UnboundedInt ) A method that adds the current UnboundedInt with a passed in one. The return is a new UnboundedInt. UnboundedInt multiply (UnboundedInt ) - do this one last! A method that multiplies the current UnboundedInt with a passed in one. The return is a new UnboundedInt. void addEnd ( int ) -optional method (helpful) A method to add a new element at the end of the sequence , used for building up each higher term in a single sequence. (i.e. adding a new IntNode to the linked list) UnboundedInt clone( ) a method that returns a copy of the original structure boolean equals ( Object ) a method that returns true if linked list represents the same numerical number as the input parameter. False otherwise. Overrides method in Object class. String toString ( ) creates a string of all elements…Decision Structures Do this for jGrasp This program will calculate the cost of having a framed picture for customers. After the customer enters the appropriate prompted values, the program will calculate the cost of the framing based on the specifications outlined below. The program should allow the user to order a second frame if desired. Define a java instance class as described below. Save the class definition in a file with an appropriate filename. Class Name: Frame Instance Variables: length – float (representing inches) (Fields) width – float (representing inches) type – char (valid values P, W, or M for Plastic, Wood, or Metal) matte – integer (representing the number of matting layers) Static Variable: count – tracks the number of frames created Instance Methods: A constructor that accepts no arguments and sets default values as follows: the length to 8,…