Java is the subject Add appropriate code segment for the given below code. Write the instantiation statement for the following code segment. class person { int ssn; string name; int age; … Public person (person ob1, person ob2) { …. } public static void main(string [] args) { ….. } }
Q: please make it run using static System.Console; class GreenvilleRevenue { static void Main()…
A: Given Code:- using static System.Console; class GreenvilleRevenue { static void Main() {…
Q: #include using namespace std; class SobolooSoba { int Komi(int num1,int num2) { return num1+num2;…
A: Given: A C++ program using the function overloading concept is provided. The functions are capable…
Q: Consider the following C++ code: static long z = 5 ; int d = 10 ; int *ptr1 = new int[2] ;…
A: Given: Consider the following C++ code: static long z = 5 ; int d = 10 ; int *ptr1 = new int[2] ;…
Q: True or false ? Assuming class Quiz { public: void TakeIt ( ); }; Quiz cs2b_quiz; Quiz * p_quiz…
A: class Quiz { public: void TakeIt ( ); }; Quiz cs2b_quiz; //declare cs2b_quiz Quiz * p_quiz =…
Q: Student Name: 8) Consider the following ciass definitions. public class LibraryID{ private String…
A: To compare `LibraryID` objects `one` and `two` inside the if statement, you would just call the…
Q: #include using namespace std; class Account { public: int accno; string name; static int count;…
A: #include <iostream>using namespace std;class Account {public:int accno;string name;static int…
Q: n a string containing all the expression info such as 50 + 50 =…
A: Code: #include <iostream>#include <vector>#include <string> using namespace std;…
Q: Given the following code segments: class Programme{ b) private String name; private static int…
A: To Do: To write the above class in better design and pattern.
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: * CENGAGE | MINBTAP Programming Exercise 3-10 D Instructions + JobPricing.java 1 import…
A: import java.util.Scanner; public class JobPricing { public static void main(String[] args) {…
Q: Create a class called Employee that includes three data members: a first name (type string), a last…
A: Consider given monthly salary as x The yearly salary can be calculated as y_x = 12*x Now, giving 10%…
Q: homework instructions- Read the steps carefully and follow them correctly. side note- please don’t…
A: I have provided JAVA CODE along with OUTPUT SCREENSHOT---------------- An exception is a…
Q: #include #include #include class Snack{ public: Snack(std::string, float, bool); int…
A: Class Definition:Establish a class named "Snack" encapsulating private attributes such as name,…
Q: #include #include #include #include #include #include using namespace std; class A { public:…
A: In this question we have to understand about the code why it is descending and not ascending in…
Q: coding rules 1. dont call upon the library 2. Dont channge the coding formate 3. fill in the…
A: Program Explanation: Declare the header files Define a class for implementing string methods…
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: 11. You may have noticed that the name parameter in SetName was also changed to a cons reference.…
A: Here is the answer.
Q: b) Given the following code segments: class Programme{ private String name; private static int…
A: A class is contains two types of members. Data members and methods.
Q: Consider the following code. public class Test { public static void main(String[] args){ NClass nc =…
A: To do: Given MCQ
Q: Consider the following code segment and answer questions 14 and 15. class Point { public: Point…
A: A constructor is a unique method or function used in object-oriented programming that is invoked…
Q: Smoothie constructor should accept a list of ingredients. • Should not be empty => throw…
A: The completed code is given below: using System.Collections.Generic;using System;using…
Q: #include #include #include class Snack{ public: Snack(std::string, float, bool); int…
A: The following are steps needs to be taken for the required function:We ask the float value price…
Q: C++ Define an "Expression" class that manages expression info: operand1 (integer), operand2…
A: The C++ code is given below with output screenshot
Q: Please fill in all the code gaps if possible: (java) public class valueData { private String…
A: Your java code is given below as you required.
Q: C++ Programing ATTRIBUTES NOTE: The important method has been given to you. userld:int //generates…
A: A class is the basic unit of object oriented design. An instance of a class is called an object. A…
Q: Use Python Programming Language (The Stock class) Design a class named Stock to represent a…
A: Coded using Python 3.
Q: public static void main(String [] args) { // Step 2: Construct a Day object representing today and…
A: As per the given problem, we need to perform steps 2 to 9 in Java thereby completing the java…
Q: Computer Science c++ help comment code please. Complex has multiple parameters to overload i think.…
A: The given class Complex has 2 private attributes real and complex The class has default constructor,…
Q: Lab 1 - Chapter 4 The Efficiency of Algorithms 01/24/2023 In this lab, you will practice how to…
A: The algorithms of the code algorithmA(n): Step 1: Set startTime to System.nanoTime() Step 2: Set…
Q: main.cpp include 2 using namespace std; 3 int maxResult() 4-( int maxVal 6. for (int i = { for (int…
A: code is
Q: complete and create magical square #include using namespace std; class Vec { public: Vec() { }…
A: #include <iostream> using namespace std; class Vec { public: Vec() { } int size() { return…
Q: class Airplane – highlights -- planeID : String -planeModel: String //”Boeing 757” etc.…
A: class AirPlane{private id String ;private int model;private int capacity;private String pilot;…
Q: Program 2: The driving class CarTest public class CarTest { ||--- // Creates and exercises some Car…
A: Please refer to the following step for the complete solution to the problem above.
Q: Describe this project in 8 to 10 lines.
A: This can be simply named as Hotel management System
Q: write c++ code for Design a class named Computer that holds the make, model, and amount of memory…
A: The class diagram and the runner code of the given program is provided in the next step.
Q: Nutritional information (classes/constructors) PYTHON ONLY Complete the FoodItem class by adding a…
A: Given: Complete the FoodItem class by adding a constructor to initialize a food item. The…
Q: Fix all the errors and send the code please // Application looks up home price // for different…
A: After removing error, the resulting Java codes are: import java.util.*;public class DebugEight3{…
Q: b) Describe a procedure visitors should follow to find a free parking space when the space they are…
A: I'm providing you the both B and c part of the above mentioned. I hope this will help you..
Q: Modify the DayOfYear class, to add a constructor that takes two parameters: a string object…
A: Algorithm:Define a class DayOfYear with a private mutable integer day representing the day of the…
Q: 4. Write part of the code that removes the car from the dealer class that is sold.
A: // part 4:- function to remove class from dealer class public void removeCar() { // delete current…
Step by step
Solved in 2 steps
- Computer Science const int a = 10; const int b = 20; const int *const aPtr = &a; aPtr = &b; something wrong about the code above. What is it?//Assignment 06 */public static void main[](String[] args) { String pass= "ICS 111"; System.out.printIn(valPassword(pass));} /* public static boolean valPassword(String password){ if(password.length() > 6) { if(checkPass(password) { return true; } else { return false; } }else System.out.print("Too small"); return false;} public static boolean checkPass (String password){ boolean hasNum=false; boolean hasCap = false; boolean hasLow = false; char c; for(int i = 0; i < password.length(); i++) { c = password.charAt(1); if(Character.isDigit(c)); { hasNum = true; } else if(Character.isUpperCase(c)) { hasCap = true; } else if(Character.isLowerCase(c)) { hasLow = true; } } return true; { return false; } }C++ Help me fix my code please! I'm missing something and can't figure it out. Code and error picture are below. #include <iostream> using namespace std; class Employee{ public: string first_name; string last_name; int monthly_sal; int increment; Employee() { first_name=""; last_name=""; monthly_sal=0; increment=0; } void setFirst_Name(string first_name) { this->first_name=first_name; } void setLast_Name(string last_name) { this->last_name=last_name; } void setSal(int monthly_sal) { if(monthly_sal<0) this->monthly_sal=0; this->monthly_sal=monthly_sal; } void setInc(int increment) { monthly_sal += increment; } string getFirst_Name() { return first_name; } string getLast_Name() { return last_name; } int get_salary() { return monthly_sal; } int get_increment() { return increment;…
- 2- Consider the following program:public class Product{ private int price;public void setPrice(int theprice){price = thePrice;}}public class SpecialProduct extends Item{ private int discount;public void setDiscount(int theDiscount){discount = theDiscount;}}public class Main{public static void main(String[]args){SpecialProduct product = new SpecialProduct();}}Which of the following compiles without a problem? Why?a. product.discount = 20;b. product.setDiscount(20);c. product.setPrice(50);Finish the Java code: Code: class Tile{char letter;int value; //ConstructorTile(char l, int v){letter = l;value = v;} //The function returns value of data member value.public int getValue(){return value;}//The function returns value of data member letter.public char getLetter(){return letter;} //the function return string for value and letterpublic String toString(){return(letter + " with value " + value);} //The function checks for equality of two objects.public boolean equals(Tile t){if(this.letter == t.letter && this.value == t.value)return true;elsereturn false;} } Output: The word HELLO is worth 8 points Its tile with the highest value is: H with value: 4 You have used a total of 5 tiles so far.// The language is java Part I: Use of recursive method (4 points for students who need recursion/extracredit) Description: Code a class called RecursiveMultiply in which it will accept two integer arguments entered from user; pass these integers to a recursive method that returns the multiplication result of these two integers. The multiplication can be performed as repeated addition, for example, if two integers are 7 and 4: 8 * 4 = 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 You will write the application with GUI and recursion to display the result in a noneditable text field, based on the user’s entry from two text fields, while an OK button is pressed. You will utilize the exception handling code as you did in your Lab 4 and Lab 5 to verify if data entered in the text fields are valid (numerical and positive data only). You will make your own decision if there is any explanation that is not described in this specification. Finally, code a driver program that will test your class…
- This assignment is not graded, I just need to understand how to do it. Please help, thank you! Language: C++ Given: Main.cpp #include #include "Shape.h" using namespace std; void main() { /////// Untouchable Block #1 ////////// Shape* shape; /////// End of Untouchable Block #1 ////////// /////// Untouchable Block #2 ////////// if (shape == nullptr) { cout << "What shape is this?! Good bye!"; return; } cout << "The perimeter of your " << shape->getShapeName() << ": " << shape->getPerimeter() << endl; cout << "The area of your " << shape->getShapeName() << ": " << shape->getArea() << endl; /////// End of Untouchable Block #2 //////////} Shape.cpp string Shape::getShapeName() { switch (mShapeType) { case ShapeType::CIRCLE: return "circle"; case ShapeType::SQUARE: return "square"; case ShapeType::RECTANGLE: return "rectangle"; case…C++ Define an "Expression" class that manages expression info: operand1 (integer), operand2 (integer), and the expression operator (char). It must provide at least the following method:- toString() to return a string containing all the expression info such as 50 + 50 = 100 Write a command-driven program named "ListExpressions" that will accept the following commands:add, listall, listbyoperator, listsummary, exit "add" command will read the expression and save it away in the list "listall" command will display all the expressions "listbyoperator" command will read in the operator and display only expressions with that given operator "listsummary" command will display the total number of expressions, the number of expressions for each operator, the largest and smallest expression values "exit" command will exit the program Requirements:- It must be using the array of pointers (not vector) to Expression objects to manage the list of Expression…class implementation file -- Rectangle.cpp class Rectangle { #include #include "Rectangle.h" using namespace std; private: double width; double length; public: void setWidth (double); void setLength (double) ; double getWidth() const; double getLength() const; double getArea () const; } ; // set the width of the rectangle void Rectangle::setWidth (double w) { width = w; } // set the length of the rectangle void Rectangle::setLength (double l) { length l; //get the width of the rectangle double Rectangle::getWidth() const { return width; // more member functions here
- this java class has a documentation comments describing the content to be added to it. Class Finder has 3 items TODO , write the code to add them to it /** * This class provides functions to search in arrays */ public class Finder { /** * Finder id */ private String id; /** * TODO: 1 * Constructor of the Finder type * * @param id String the id of the Finder */ public Finder(String id) { } /** * TODO: 2 * Getter method that returns the id of the Finder. * * @return String the id of the Finder */ public String getId() { } /** * TODO: 3 * Finds if an element is in an integer array. * * @param input Integer[] the array to search in * @param target Integer the value to search for * * @return int the index of the element if found, else -1 */ public int findElement(Integer[] input, Integer target) { } }The class definition for an Item is given in the image UML diagram below Note: getInfo() returns a string containing ALL of the state information neatly organized. Part 1: Create a class based on the specification above. Reminder: – means private and + means public. Part 2: a)Write a function/method called “addItem” that takes: An array of items The number of items in the array An integer representing a barcode A string representing the name of an item A string representing the description of an item A double value representing the price The function must create and add the item to the array if there is space. The function must return “true” if the addition was successful and “false” otherwise. b)Write a function/method called “listItems” that takes: An array of items The number of items in the array The function must return a string containing the information on each item in the array. c)Write a function called “pricelookup” that takes : An array of items The number of…C++ Define an "Expression" class that manages expression info: operand1 (integer), operand2 (integer), and the expression operator (char). It must provide at least the following method:- toString() to return a string containing all the expression info such as 50 + 50 = 100 Write a command-driven program named "ListExpressions" that will accept the following commands:add, listall, listbyoperator, listsummary, exit "add" command will read the expression and save it away in the list "listall" command will display all the expressions "listbyoperator" command will read in the operator and display only expressions with that given operator "listsummary" command will display the total number of expressions, the number of expressions for each operator, the largest and smallest expression values "exit" command will exit the program Requirements:- It must be using the array of pointers to Expression objects to manage the list of Expression objects. Please…