Question 4: What does the following code output? vector icecream ( 10, "Vanilla" ); icecream.insert( icecream.begin() +5, "Chocolate" ); icecream.erase( icecream.begin () +0, icecream.begin () +4 ); icecream.pop_back () ; icecream.pop_back () ; icecream.pop_back () ; icecream.pop_back (); icecream.push_back( "Mint" ); icecream.push_back( "Almond ); cout << "ICECREAM: [--"; 0 i < icecream.size(); i++) for int i cout << icecream[ i ]< "--"; cout << "] ";
Q: Write the following functions that fill a rectangle with the specified color, center, width, and…
A: The function def drawRectangle(color = "black",x=0, y=0, width = 30, height = 30) is shown below.…
Q: ++ Write a function named “createPayStub” that accepts the number of hours (integer), and the…
A: Algorithm: Step1: Declare the function Step2: In main, declare variable and initilize the variables…
Q: Estimated Completion Time: 2-3 minutes Which of the following situations will lead to an object…
A: Database Management System(DBMS) is a software for storing and retrieving users data while…
Q: Design Foodcart class and Food class so that the following code provides the expected output.
A: Food object has name, shop, price Foodcart object has name, list of Food objects
Q: 2 iii) int a = 5; //L1 5; i <= 6; i++) //L2 for(int i { а %3D а + 3; //L3 //L4…
A: In this question, we have to trace the code and fill the given table. For loop will run recursively…
Q: Which type of polymorphism is depicted in the following code? void PlayerName(string Coach) {…
A: Given: Given a code . To Do: To choose the correct option.
Q: How do I fix the Java code? Error: OK --- overloaded constructor exists OK --- movieName set…
A: 1)The first 2 SOPln statements are just to debug the code and I didnt deleted them, incase it may…
Q: [JAVA] attached below is the problem statement…
A: import java.util.*;import java.util.stream.*;public class Main{ // copy from here…
Q: Below is my failing code, Need help fixing the issue.…
A: Your code seems to be perfect, only reason its not running is because its expecting the grades.txt…
Q: 1. (Composition) Write a Pizza class so that this client code works. Please note that it is ok if…
A: # The Pizza class should have two attributes(data items): class Pizza: # The Pizza class should…
Q: game. You will create a character and then use it to battle a computer generated opponent. There are…
A: /**Move.Java**/ public class Move { private String name; private String type; private int power;…
Q: Write a program contained a class Student which has firstName, lastName, mark, grade. The program…
A: **Note: Save the code in a file named "Student.java" otherwise it will not compile. This is because,…
Q: sincludeciostream> using namespace std; struct Employee int Id; char Name[25]; 8. int Age; 9. long…
A: Given Data : C++ Code Output Check whether the C++ code produces the same output as given in the…
Q: QUESTION 31 Write a Java program to create a Hashmap for various courses in an University with two…
A: Java Program: // Import the HashMap classimport java.util.HashMap;import java.util.Scanner; public…
Q: write a for-each loop that prints all the elements in a collection of Student objects called role.…
A: Program using java: import java.util.*; public class Student{ int id; String name; public…
Q: E Template 2 import random 3 4 vclass Card: def init__(self, value, suite): self.value - value 6 7.…
A: Solution :: Python code : ### Template import random class Card: def __init__(self, value,…
Q: PrintMeFirst.h o SavingsAccount.h SavingsAccount.cpp CheckingAccount.h CheckingAccount.cpp…
A: SavingsAccount.h #ifndef SAVINGSACCOUNT_H#define SAVINGSACCOUNT_H#include "BankAccount.h"#include…
Q: ** Attached with this assignment two classes: Student (in file Students.java) and Faculty (in file…
A: ⦁ Here we have to construct a java program to enter the student details and the faculty details and…
Q: How do I fix the error in the Java code? Error: OK --- overloaded constructor exists OK ---…
A: According to the information given:- We have to fix the error in the given java program.
Q: Assign a pointer to any instance of searchChar in personName to searchResult.
A: Below is the answer with explanation:
Q: Dont post from internet. Which type of polymorphism is depicted in the following code? void…
A: According to the Question below the Solution:
Q: How do I make the code pass these tests? Tests: OK --- overloaded constructor exists OK ---…
A: Hi, I tried to modify the code to work and provided the output as well.…
Q: Assume myArray and myList are oth of the same type and size, so the ollowing statement will copy the…
A: Answer is false Doesn't copy elements of myList[] to myArray[], only makes myArray refer to same…
Q: This class will contain the method necessary to read and parse the .csv file of stock information.…
A: class DateFormatException extends IllegalArgumentException { public DateFormatException(String…
Q: Multiple choice in java Given the following code snippet: ArrayList shapes = new…
A: Given: Scanner scan1=new Scanner(new File("D:\\AAUJ\\AAA\\radiusInfo.txt")); //This statement is…
Q: ++ in visual studio: Implement it completely with copy constructor, overloaded assignment operator…
A: C++ language is a direct descendant of C programming language with additional features such as type…
Q: Your program must process the following four commands. Create account amount Deposit account amount…
A: /** * This class performs bank operations*/public class Account { private int accNumber;…
Q: Need Help For Java. Thanks. Suppose that the class Score is defined as class ScoreInfo {…
A: Import stream collector, array, list package. The Main class consists of data to store the student…
Q: You are to create a database of books that are stored using a vector. Keep track of the author,…
A: You are to create a database of books that are stored using a vector. Keep track of the author,…
Q: Display the first name and salary*10000 of all employees who works for department 50. Handle…
A: declarecursor c isselect first_name, last_name, department_idfrom employeeswhere to_char(hire_date,…
Q: Task 7 Suppose you are given two dictionaries. Now create a new dictionary "marks", merging the two…
A: The code is written below: #first dictionary with given elements d1={'Harry':15, 'Draco':8,…
Q: ant note: your code must compile correctly and run without errors. Otherwise, your code will get the…
A: It is defined as one of the most popular programming languages that is being widely used in the IT…
Q: 5- Which command in MATLAB performs matrix operation on elements? a) a' b) a_4 c) a^3 d) a.*b 6-…
A: Please find the answer below :
Q: 1 Write an interface name InterfaceSet with the following components: Attribute: max an integer…
A: The text and the formatted image version of the programs are given in this and the subsequent steps.…
Q: A list of students (student ID, first name, last name, list of 4 test grades) will be transformed…
A: GradeCalculator.java public class GradeCalculator{ public String convertToLetterGrade(double grade){…
Q: This code doesn't work, please help me. ----------------------------------- #include #include…
A: Code: #include<iomanip>#include<iostream> #include <fstream>using namespace std;//…
Q: please write the following code without using built-in java methods)Create two files called…
A: Please find below your answer here I have a program for BST Binary tree in java and all other…
Q: A InventoryOnShelf object will contain two private fields, itemOnShelflist, an array of (up to 5)…
A: Here, in class InventoryOnShelf , you need to declare 2 private fields, one is array of ItemOnShelf…
Q: Creates a class called College with 6 attributes: a. maxStud: a maximum number of Student into the…
A: Note: As no programming language is mentioned. So I am using Java to answer this question.
Q: void writeEmpToFile(Employee *emp, FILE *f) { fwrite(&emp->salary, sizeof(emp->salary), 1, f);…
A: Since you are asked to write writeEmpToFile() method, I have implemented that function only and…
Q: Create a class called AddressBook that uses either C++ - Vector in the data section of the class.…
A: Actually, given information: Create a class called AddressBook that uses either C++ - Vector in…
Q: Can you implement a module named inventory that will be responsible for managing the players…
A: Creating a Module Inventory: Create an empty folder Inventory using mkdir Execute Following…
Q: lubMember class class ClubMember: #__init_ function def __init__(self,id,name,gender,weight,phone):…
A: PROGRAM : #ClubMember classclass ClubMember: #__init_ functiondef…
Q: Write a line of code that declares an object teenager that stores a single int value and…
A: NOTE - I have used java programing language. Here I have created a class named teenager with one…
Q: Which of the following cannot be used as constructors ? a. T[] array = new T[10]; b. T[] arr =…
A: Which of the following cannot be used as constructors ? a. T[] array = new T[10]; b. T[] arr =…
Q: Required program is java Create a class called DuplicateRemover. Create an instance method called…
A: Program Instructions:In class DuplicateRemover, declare a set of Strings and create methods remove()…
Q: void writeEmpToFile(Employee *emp, FILE *f) { fwrite(&emp->salary, sizeof(emp->salary), 1, f);…
A: Sol: This code is nothing but piece of code and to write employee detail to the file after calling…
Q: 1. Write an interface name InterfaceSet with the following components: Attribute: max an integer…
A: The given problem is related to Java programming where an interface named 'InterfaceSet' and a class…
Q: This is a short exercise in using the stream API. Suppose that the class Score is defined as class…
A: the answer is given below:-
Q: How do I implement a file with sets of numbers, such as 0 4 2 6 0 9 1 5 to an adjacency matrix
A: An adjacency matrix is a V x V binary matrix A (a binary matrix is a matrix in which the…
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- Please, I want to modify the code so that the user can add the employee's name, number and specialization, and use for loob He must add more than one employee. When he finishes adding the employee’s data, he asks the user: Do you want 1-Print the data 2-Add a new employee 3-Exit class Doctor:"""Represents a Doctor""" #initializer with specialization default to "general"def __init__(self, Id, name, specialization="general"):#attributesself.Id = Idself.name = nameself.specialization = specialization.lower() #initializing salary to 25000, basic salaryself.salary = 25000 #incrementing salary based on specialization#if specialization is pediatric, increasing salary by 10%if specialization == "pediatric":self.salary += self.salary*10/100 #if specialization is dental, increasing salary by 15%elif specialization == "dental":self.salary += self.salary*15/100 #str() functiondef __str__(self):return (f"Id: {self.Id} \n"f"Name: {self.name} \n"f"Specialization: {self.specialization} \n"f"Salary:…A .The following JavaScript command adds a method to a built-in class that can be called on any object instance of that class.Array.prototype.scramble = function() { this.sort(function() { return 0.5 – Math.random(); });} Select one: True False B. Suppose you have written a JavaScript for loop, and one of the statements that will execute with each iteration of the loop includes an anonymous function that uses the for loop’s counter variable, i. Which statement about this loop is true? a.The anonymous function will execute when it is called by the program, using the value ofiat the time it was encountered in the loop. b. The anonymous function will throw an error if it is called by the program after theforloop has finished iterating. c. The anonymous function will execute when it is called by the program, using the value ofiafter the final iteration of the loop. d.The forloop signals the JavaScript interpreter to copy the body of the anonymous function but not its…MUST BE IN JAVA In an n-sided regular polygon, all sides have the same length and all angles have the same degree (i.e., the polygon is both equilateral and equiangular). Design a class named RegularPolygon that contains: - A private int data field named n that defines the number of sides in the polygon with default value 3. - A private double data field named side that stores the length of the side with default value 1. - A private double data field named x that defines the x-coordinate of the polygon’s center with default value 0. - A private double data field named y that defines the y-coordinate of the polygon’s center with default value 0. - A no-arg constructor that creates a regular polygon with default values. - A constructor that creates a regular polygon with the specified number of sides and length of side, centered at (0, 0). - A constructor that creates a regular polygon with the specified number of sides, length of side, and x- and y-coordinates. - The accessor and…
- You are to create a database of books that are stored using a vector. Keep track of the author, title and publication date of each book. Your program should have a main menu that allows the user to select from the following: Add a book’s author, title, and date Print an alphabetical list of the books sorted by author Quit You must use a class to hold the data for each book. This class must hold three string fields, one to hold the author’s name, one for the publication date, and another to hold the book’s title. Store the entire database of books in a vector where each vector element is a book class object. To sort the data, use the generic sort function from the <algorithm> library. Note that this requires you to define the <operator to compare two objects of type book so that the author field from the two books are compared. Note: you are required to create three files, Book.h, Book.cpp and TestProgram.cpp. Book.h #ifndef BOOK_H #define BOOK_H #include <string>…Modify songVerse to play "The Name Game" (see OxfordDictionaries.com), by replacing "(Name)" with userName but without the first letter.Ex: If userName = "Kaitlin" and songVerse = "Banana-fana fo-f(Name)!", the program prints:Banana-fana fo-faitlin! Ex: If userName = "Kaitlin" and songVerse = "Fee fi mo-m(Name)", the program prints:Fee fi mo-maitlin Note: You may assume songVerse will always contain the substring "(Name)". *Please write this code in C++*Implement the CertOfDepositArrayapplication to accept data for an array of five CertOfDeposit objects, and then display the data. The program should prompt the user for the following information (in order): Certificate # Last name Balance Month of issue Day of issue Year of issue The program should display the year the certificate matures, which is one year after it was issued, in the format YYYY-MM-DD. the first file looks like this import java.time.*; public class CertOfDeposit { privateString certNum; privateString lastName; privatedouble balance; privateLocalDate issueDate; privateLocalDate maturityDate; publicCertOfDeposit(Stringnum,Stringname,doublebal,LocalDateissue) { } publicvoidsetCertNum(Stringn) { } publicvoidsetName(Stringname) { } publicvoidsetBalance(doublebal) { } publicvoidissueDate(LocalDatedate) { } publicStringgetCertNum() { } publicStringgetName() { } publicdoublegetBalance() { } publicLocalDategetIssueDate() { } publicLocalDategetMaturityDate() { } } and the…
- I am getting a error at line 73 and 75 , can you please review the code ? //get text fields Line 73 - doubleinvestmentAmount = Double.parseDouble(investmentAmount.getTest()); Line 75 - int years = Integer.parseInt(years.getText()); package chapter15; import javafx.application.Application; import javafx.geometry.HPos; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; import javafx.scene.control.Button; import javafx.geometry.Insets; //15.5 Create an investment calculator using Text Boxes //program calculates the furtureValue at a given interest rate for a specified number of years // futureValue = investmentAmount * (1 + monthlyIntrestRate)^years*12 //Display the future amount in the test field when the users clicks the Calculate button import javafx.stage.Stage; //Steps to create a user interface program //1. Create a user interface // A. gridPane, add…Suppose you are using a jQuery animation to make an element change color when the user clicks on it, and you also want to execute a function as soon as the animation finishes running. How can you do this? a. Pass the function in as the first argument to theanimate()method called on the element. b. Use anif elseblock with thehasClass()method to determine when to call the function. c. Pass the function in as the final argument to theanimate()method called on the element. d. You cannot accomplish this using jQuery commands.Design Foodcart class and Food class so that the following code provides the expected output.cart1 = Foodcart()food1 = Food('Burger','Chillox',180)food2 = Food.createFood('Cake','Mr. Baker',1000)print("===========================")print(food1)print("===========================")cart1.addFood(food1,food2)print("===========================")cart1.setCartName("Foodpanda")cart1.addFood(food1,food2)cart1.addFood(Food('Steak','Woodhouse Grill',2000))print("Total Price Available:",Foodcart.totalPrice)print("===========================")print("Total Foods created:",Food.totalFoods)print("===========================")cart1.printCartDetails()print("===========================")cart1.removeFood("French Fry")print("===========================")cart1.removeFood("Steak")print("===========================")cart1.printCartDetails()print("===========================")print("Total Price Available:",Foodcart.totalPrice)Output:====================================Food Info : Burger, Food Shop : Chillox,…
- This code doesn't work, please help me. ----------------------------------- #include<iomanip> #include <fstream> using namespace std; class Taxi { private: string driver_name; string maker; string color; public: int calls; int passengers; static int Tpassengers; Taxi(string name, string maker, string color) { this->driver_name=name; this->maker=maker; this->color=color; this->passengers=0; this->calls=0; } Taxi(int pass) { this->passengers=pass; } int NPassenger() { int x = (rand()%10)+1; return x; } Taxi operator += (const Taxi x){ this->passengers +=x.passengers; this->calls+=1; return *this; } void write_Taxi_info() { ofstream outFile; outFile.open("CTC.txt", std::ios_base::app); outFile.close(); } }; int Taxi::Tpassengers{0}; int main() { srand((unsigned)time(0)); Taxi** taxis = new Taxi*[6]; taxis[0] = new Taxi("xyz qwe","erty","blue"); taxis[1] = new Taxi("xyz qwe","erty","blue"); taxis[2] = new Taxi("xyz…Dont post from internet. Which type of polymorphism is depicted in the following code? void PlayerName(string Coach) { cout << "In the team since " << Coach << endl; } void PlayerName(Coach Coach) { cout << "In the team since " << Coach.GetDetails() << endl; } void PlayerName(Players* playerPtr) { cout << "In the team since " << playerPtr->GetDetails() << endl; } int main() { vector<Players*> memberList; Players* playerPtr; Coach* coachPtr; memberList.push_back(playerPtr); memberList.push_back(coachPtr); for (int i = 0; i < memberList.size(); ++i) { PlayerName(memberList.at(i)); } } 1)Static 2)Runtime 3)No polymorphism 4)Compile-time.please help debuging... // Fix the bugs so that the report of 5 students grades// is correct. There should be no memory leaks.#include <stdio.h>#include <string.h>#include <stdlib.h>#include <assert.h> typedef struct student{ int grade; char* nameID;}student_t; void CreateStudent(student_t* s, int grade, char* nameID){ s->grade = grade; s->nameID = strdup(nameID); } //float ComputeAverageGrade(student_t* class, int sizeOfClass){ assert(sizeOfClass > 0 && "Must have at least 1 student"); float total=0.0f; for(int i=0; i <= 5; i++){ total+= class[i].grade; } return total / sizeOfClass;} int main(){ // Create our classroom of 5 students student_t* class = (student_t*)malloc(sizeof(student_t)*5); for(int i=0; i <5 ; i++){ // Assume all nameID's are "temporary" CreateStudent(&class[i],90,"temporary"); } // Storage for students grades float averageGrade =…