fix code and remove errors
Q: This exercise assumes that you have created the Employee class for Programming Question 1.Create a…
A: Program code: import pickle import os class Employee: def…
Q: #include #include main () int result ; printf ("ed: I am the parent. Remember my number!\n",…
A: Use the Following Command : pico labrep.c COPY AND PAST THE FOLLOWING CODE
Q: C++ language Alter the code found in main.cpp Using the file, add/change the code in the file,…
A: Coded using C++.
Q: Problem Description: Write a telephone lookup program. Read a data set of 1,000 names and telephone…
A: Program code to copy Main.java Main.java import java.io.File;import java.util.*; public class Main{…
Q: want to start from 'create function
A: We need to group by ward number and then count the staff in matching ward number
Q: def kink_polygon(poly): # YOUR CODE HERE
A: HI THEREI AM ADDING ASNWER BELOW PLEASE GO THROUGH IT THANK YOU
Q: C++ Rewrite and fix only the lines with Syntax (compiler) errors and Runtime errors. // add a…
A: Given code :- printArray(float array[], int size){ for(int k=0; k<size; k++) { cout…
Q: Section 3: Addition You now complete the subroutine "MYADD“. It is a subroutine to add the values…
A: Solution:-- 1)It is required in the question for providing the code in ASM language as I have…
Q: char lastChar(const char *str){ char last; //loop over the string and go uptill end of the…
A: char lastChar(const char *str){ char last; //loop over the string and go uptill end of the…
Q: for incorrect and copy. Make sure use function in it.
A: Code: using System;using System.Collections.Generic;using System.Linq;using System.Text;using…
Q: ease complete this in c++ . Modify. Would downvote for incorrect
A: I have written code below:
Q: ase reimplement use template fun.
A: As we know in OOPS Template functions are generic functions that can accept any data type of…
Q: #include using namespace std; int getRandom () { //generate a seeded random number //between 1 and…
A: 1) Below is completed program demonstrating function calling another function It defines function…
Q: switch_player(): we will allow the players to choose their own names, but for our purposes, it is…
A: Python is a high-level, object-oriented programming language. Python is a dynamic data type…
Q: void main() int *ptr, va-1003; ptr=&va;
A: INTRODUCTION: Explain the code and output.
Q: Explain code
A: Given is the vhdl code. vhdl is hardware description language.
Q: please code in python Forbidden concepts: arrays/lists (data structures), recursion, custom classes…
A: Below is the required code in python and sample output:
Q: The AdvancedCalculator class represents a calculator that supports multiple expressions over many…
A: Code: class AdvancedCalculator: ''' >>> C = AdvancedCalculator() >>>…
Q: All should be written in python. Please include docstring. Do NOT use the isalpha() funciton. Write…
A: 1) Below is program that write a function named count_letters that takes as a parameter a string and…
Q: Help code.
A: PROGRAM INTRODUCTION: Include the required header files. Start definition of the method to…
Q: Briefly explain the difference between new operator and delete operator.
A: Dynamic Memory Allocation is used to avoid wastage of memory in programming
Q: low many activation records doos this recursive function create if it is.called as fun(E nt fun(int…
A: Here the main function will call fun(7, 2) and then each function fun () will call itself untill…
Q: Reducing code duplication with functions. Many songs are made of parts, like verses and chorus, that…
A: The program is implemented in C++ with a structured approach. We will be printing the lyrics of the…
Q: True or False Individual variables are well suited for storing and processing lists of data.
A: Explanation: Every variable is an individual item which should be declared and assigned…
Q: #include void main( ) {int m,n; for(m-1;m<4;++m) {for(n=m;n<8;++n) if(m<n) cout<<"*"<<"\t"; else…
A: Option B i.e. syntax error is correct. As in the end we miss one bracket and in the second line use…
Q: LAB RESTRICTIONS, PLEASE READ: Do not add any imports, the ones that you need will be given to you.…
A: Please find the answer below :
Q: #include // size_t for sizes and indexes using namespace std; ///////||/ WRITE YOUR FUNCTION BELOW…
A: We need to define the appendEvens() as per the given requirements.
Q: In Python: Design a Student class to store the first and last name of a student. Add operators or…
A: print("-----Program for Student Information-----") D = dict() n = int(input('How many student record…
Q: Problem DNA: Subsequence marking A common task in dealing with DNA sequences is searching for…
A: Given The answer is given below.
Q: SC 242 assignment:* Write *3 code snippet each in python* that contains For loop, While loop and…
A: For loop: def main(): for i in range(10): print(i,end=" ")main()output:
Q: Define the function: int countVowel(char word[]); The function returns the number of vowels the…
A: Note: You didn't mention any programming language. So I use C language to write this program. C…
Q: Define a problem with user input, user output, Pointer, with const and sizeof operator. If no output…
A: Design meaning the structure which can be defined by PSEUDOCODE. code #include <iostream>using…
Q: nacci sequence begins with 0 and then 1 follows. All subsequent values are the sum of the previous…
A: Given The Fibonacci sequence begins with 0 and then 1 follows. All subsequent values are the sum of…
Q: ______ does not end a request. response.write() response.end()…
A: The correct option would be a response.write().
Q: Python please prime_test.py: def is_prime(num): #ADD CODE to return True if num is prime; False…
A: #creating function to check prime def is_prime(num): #this loop will run from 2 to num-1 for…
Q: Fill-in-the-Blank A(n) __________ is a special value that marks the end of a series of values.
A: sentinel
Q: n python create function that has a parameter of dict[str, str] key should be a name value should…
A: Input : Dictionary [Name,Color Name] Output : Most common color
Q: PYTHON PROGRAMMING. USE PROVIDED STARTING CODE TO COMPLETE THIS TASK. Create a glossary…
A: According to the information given:- We have to create dictionary to add word and definition and…
Q: Fill-in-the-Blank You should only use the delete operator to deallocate memory that was dynamically…
A: GIVEN: Fill-in-the-Blank You should only use the delete operator to deallocate memory that was…
Q: Create overloaded add() function definitions; one adds two integers, while the other concatenates…
A: As no programming language is mention, so I will solved this question using java programming…
Q: n python create function that has a parameter of dict[str, str] key should be a name value should…
A: Input : Dictoinary in the form of the key as number and value as color. Output : Most frequent…
Q: in python create function that has a parameter of dict[str, str] key should be a name value…
A: def mostFreq(dictA): # function to return most frequent value in a…
Q: • Add a function atbash_wrapper() · It should take two input parameters: input_string and method ·…
A: Encryption is the technique of converting plaintext or a normal message into decrypted message…
Q: n:Temperature Statistics Learning Objectives In this lab, you will
A: def check_input(temperature): # check if the temperature is possible or not # if the…
Q: Bug sort out and fix all. )
A: Algo: Start Initialize matrix x Find inverse of matrix x Find diagonal of matrix x Find sum of each…
Q: This assignment requires a dictionary of state abbreviations and their capital cities. The…
A: # create a dictionary with any four states myDict = {"AL": "Montgomery", "CA": "Sacramento",…
fix code and remove errors
Step by step
Solved in 2 steps with 1 images
- 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); } }public class LabProgram { public static void main(String args[]) { Course course = new Course(); String first; // first name String last; // last name double gpa; // grade point average first = "Henry"; last = "Cabot"; gpa = 3.5; course.addStudent(new Student(first, last, gpa)); // Add 1st student first = "Brenda"; last = "Stern"; gpa = 2.0; course.addStudent(new Student(first, last, gpa)); // Add 2nd student first = "Jane"; last = "Flynn"; gpa = 3.9; course.addStudent(new Student(first, last, gpa)); // Add 3rd student first = "Lynda"; last = "Robison"; gpa = 3.2; course.addStudent(new Student(first, last, gpa)); // Add 4th student course.printRoster(); } } // Class representing a student public class Student { private String first; // first name private String last; // last name private double gpa; // grade point average…Based on Figure 3, create a class named Child that inherits the Father class. Declare an instance name location (String) for class Child. [3 marks]
- interface StudentsADT{void admissions();void discharge();void transfers(); }public class Course{String cname;int cno;int credits;public Course(){System.out.println("\nDEFAULT constructor called");}public Course(String c){System.out.println("\noverloaded constructor called");cname=c;}public Course(Course ch){System.out.println("\nCopy constructor called");cname=ch;}void setCourseName(String ch){cname=ch;System.out.println("\n"+cname);}void setSelectionNumber(int cno1){cno=cno1;System.out.println("\n"+cno);}void setNumberOfCredits(int cdit){credits=cdit;System.out.println("\n"+credits);}void setLink(){System.out.println("\nset link");}String getCourseName(){System.out.println("\n"+cname);}int getSelectionNumber(){System.out.println("\n"+cno);}int getNumberOfCredits(){System.out.println("\n"+credits); }void getLink(){System.out.println("\ninside get link");}} public class Students{String sname;int cno;int credits;int maxno;public Students(){System.out.println("\nDEFAULT constructor…Incorrect Question 6 public class Shape { Color fillColor; } public Shape() { fill Color = Color. RED; } } public Shape(Color fillColor) { this.fill Color = fillColor; } public class Circle extends Shape { int radius; public Circle() { radius = 1; } public Circle(int radius) { this.radius = radius; } public Circle(int radius, Color fillColor) { } super(fillColor); this.radius = radius; Circle c1= new Circle(); Circle c2= new Circle(5); Circle c3 = new Circle(10, Color.BLUE); Which of the following are correct? c2 has radius 5 c1 is red c2 is red c3 has radius 10 c3 has radius 1 c3 is red c1 is blue ✔c2 has radius 10 c3 is blue c1 has radius 5 c1 has radius 1 c2 has radius 1 c2 is blueWhat is outpout? public class Vehicle { public void drive(){ System.out.println("Driving vehicle"); } public class Plane extends Vehicle { @Override public void drive(){ System.out.println("Flying plane"); } public static void main(String args[]) { Vehicle myVehicle myVehicle.drive(); } } = new Plane(); syntax error Driving vehicle Flying plane Flying plane O Driving vehicle
- Public Class SavingsAccount { float interest; float FixedDeposit; SeniorAccount(float interest, float FixedDeposit) { this. interest = interest; this.fixedDeposit= FixedDeposit; } float calculateInterest(); { System.out.println(“Calculating Savings Account Interest”); return(FixedDeposit*interest/100); } } Public Class SeniorAccount extends SavingAccount { float seniorInterest; SeniorAccount(float interest, float FixedDeposit) { this.seniorInterest=interest; super(interest, FixedDeposit) } float calculateInterest() { System.out.println(“Calculating Savings Account Interest”); return(FixedDeposit*seniorinterest/10); } } Public static void main(String args[]) { SavingsAccount saving = new SavingsAccount(6,100000); System.out.println(saving.calculateinterest()); SeniorAccount senior=new seniorAccount(10,100000); System.out.println(Senior.calculateInterest()); } Correct the syntax and logical errorPublic Class SavingsAccount { float interest; float FixedDeposit; SeniorAccount(float interest, float FixedDeposit) { this. interest = interest; this.fixedDeposit= FixedDeposit; } float calculateInterest(); { System.out.println(“Calculating Savings Account Interest”); return(FixedDeposit*interest/100); } } Public Class SeniorAccount extends SavingAccount { float seniorInterest; SeniorAccount(float interest, float FixedDeposit) { this.seniorInterest=interest; super(interest, FixedDeposit) } float calculateInterest() { System.out.println(“Calculating Savings Account Interest”); return(FixedDeposit*seniorinterest/10); } } Public static void main(String args[]) { SavingsAccount saving = new SavingsAccount(6,100000); System.out.println(saving.calculateinterest()); SeniorAccount senior=new seniorAccount(10,100000); System.out.println(Senior.calculateInterest()); } Rubric: Correct the syntax and logical errors Proper working codeclass Student { private int age = 18; public Student() { age = 19; } } public class Test { public static void main (String[] args){ Student s = new Student(); System.out.println (s.age); } }
- 8. OOPS Theory #6 public class Car { public void horn() { System.out.println("Horn horn"); } } public class Ferrari extends Car { public void horn() { System.out.println("Ferarriiiiii"); } } public static void main(String[] args) { Ferrari ferrari = new Car(); ferrari.horn(); } Pick ONE option Horn horn Ferarriiii Cannot compile Runtime exception Clear Selection 9. OOPS Theory #7 In Java, we can achieve the abstraction by creating the blueprint of an object and only have abstract methods. What do we call this? Pick ONE option Interface Encapsulation Instance Protected Clear SelectionClass Quiz public Quiz (int quesList, int quesMissed) {quesList = this.quesList;quesMissed = this.quesMissed;} private void calculate(){// get the point worth of each question and calculate final scorepointsPerQues = (100/quesList);scoreQuiz = quesList - quesMissed;} Class PassFailQuiz public PassFailQuiz (int quesList, int quesMissed, int scoreQuiz) { super(quesList, quesMissed);} How do I move scoreQuiz from private void calculate() to equal the third constructor value in PassFailQuiz?// Simulates a simple car with operations to drive and check the odometer.public class SimpleCar { // Number of miles driven private int miles; public SimpleCar(){ miles = 0; } public void drive(int dist){ miles = miles + dist; } public void reverse(int dist){ miles = miles - dist; } public int getOdometer(){ return miles; } public void honkHorn(){ System.out.println("beep beep"); } public void report(){ System.out.println("Car has driven: " + miles + " miles"); } }