++ Write a function named “createPayStub” that accepts the number of hours (integer), and the hourly payrate (double). It will return the pointer to a newly created PayStub object. If the given hours or payrate is negative, it will return nullptr. In addition, it also returns the total payout amount to the caller (in the output parameter). Please show how this function is called and returning the proper information.
Q: Question 6 Write a Java class method createJSON() to return an object with type JSONObject which…
A: here in the question ask for a develop a json object as per question,.
Q: You are given a super class called Animal and a sub-class (derived class) called Reptilian. The…
A: the ans is an D
Q: Question No 8. Analyze the picture below and write appropriate code for it. Also Add following…
A: As per our company guidelines I am solving the first question. Please repost the other. Explanation:…
Q: The class Real is a number type with a whole and a fraction part; both are ints. Write a conversion…
A: The class Real is a number type with a whole and a fraction part; both are int. Write a conversion…
Q: Part-1: Study the following method, then perform the required steps and answer the questions below:…
A: SOURCE CODE // Main classpublic class Main{ // swap method public static void swap(int num1 ,…
Q: Now write a test program that performs the following tasks: 1. Create a Faculty object with an id of…
A: A Computer Program is a set of instructions , that can be executed by a computer to perform a…
Q: Q3: Continue of previous question (20pt) 1. Copy the previous program to a new file. 2. Convert…
A: To convert the output function to abstract one, we use the keyword virtual.
Q: What is the value of arysize after executing the following code: Answer: int testAry[] = {…
A: output : 1 this is because sizeof(arysize) represent the size of first element and it is divided by…
Q: Identify the errors in the following program segment and describe how to correct them. You can…
A: Given: FloatProperty f=new FloatProperty(1.0); FloatProperty f2=new FloatProperty(2.0);…
Q: Write the application AutomobileDemo that prompts a user for data for eight Automobile objects in C#…
A: Required C# code provided below :
Q: Consider the following Javascript code: function Tool(name, ID, isPower, isCheckedOut) { this.name =…
A: The solution to the given problem is below.
Q: Copy your previous class definition for RectangularSolid from the previous problem, including both…
A: Answer: class Rectangular Solid # constructor def _int_(self, l, w, h) self. l = 1 self.h = h self.w…
Q: When you print an instance of the class Food in Question 1, you get something like this: Building…
A: code : - class Food: def __init__(self,name,taste): self.name = name self.taste =…
Q: Implement function WriteRectangle to display a (filled) rectangle on the screen, with the width and…
A: According to the information given:- We have to follow the instruction in order to get desired…
Q: In the following code: public interface Lambdas extends Shape{ void print0; void printOdds(int n);…
A: Java interfaces cannot extend classes, which makes sense since classes contain implementation…
Q: Q5: Correct the following code fragment and what will be the final results of the variable a and b…
A: Dear student, the answer is provided below.
Q: A pedometer treats walking 2,000 steps as walking 1 mile. Write a steps_to_miles() function that…
A: The Answer is
Q: Lab04-06. Change the definition of the following constructor to use initialization instead of…
A: A function or method can be initiated by using the initializer list. The syntax is shown below.…
Q: Write a lambda or method reference for each of the following tasks: a) Write a lambda that can be…
A: As per Bartleby guidelines “Since you have posted a question with multiple sub-parts, we will solve…
Q: This assignment uses the same account class created in Lab #4 with a more generally useful…
A: This program is written in C++. Please find the program below.
Q: Which of the following statements are correct about the given code snippet? class A: def…
A: Introduction: Inheritance allows us to construct a class that inherits all of the methods and…
Q: Exercise: return object as parameters Complete the following program by completing the method named…
A: Find the required code given as below and output:
Q: Create a MyTime class which is designed to contain objects representing times in 12-hour clock…
A: The classes are designed as per the requirement in the next step:
Q: Consider the following implementation of setTime(), what is the value of MyNUM so as to make the…
A: The answers are given below with some explanation
Q: Write a program with a class that contains an array of integers. Initialize the integer array in the…
A: /*Program to create an array class, with constructor, destructor and friend functions*/ #include…
Q: This code will be used to answer the question at the bottom. public class AccountBalance {…
A: Code for above mentioned problem is in step 2
Q: What is the output of the following program? Carefully note the placement of the virtual keyword.…
A: Destructor in c++ -It is a member function of a class used to free the space occupied by or delete…
Q: Question: Implement the following functions in your class: getTotalWords (returns the amount of…
A: import sysdatafile='covid1.txt'datafile_data=[] #list of all words in the datafiledatafile_temp=[] #…
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: Please use java. In this assignment, you will implement a simple class called CustomString. This…
A: Java Program used to answer this question
Q: Create a MyTime class which is designed to contain objects representing times in 12-hour clock…
A: public class MyTime{ private String myTime; //instance variable //constructor that…
Q: Please finish this program in the main() function, so that we get the output 1 2. class Basel {…
A: #include <iostream>using namespace std;class Base1{ private: double data; public:…
Q: Please Fix this program
A: Point p0(); // Calling Default Constructor This is incorrect way of making object of default…
Q: Implement the copy assignment operator= for the StringVar class using the options given on the right…
A: Actually, string is a sequence of characters.
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: Write a statement to create an array, named productList, in a supportive class, with a size of TEN…
A: Note: As per our guidelines, we are allowed to answer only first question of multiple questions.…
Q: Implement the below application which identifies and displays the first na First Name
A: code is below:
Q: Question: Implement the following functions in your class: getTotalWords, getUniqueWords,…
A: The solution is given below:
Q: Write a driver class (application) to test the class Aquarium. In the main method we would like to:…
A:
Q: lubMember class class ClubMember: #__init_ function def __init__(self,id,name,gender,weight,phone):…
A: PROGRAM : #ClubMember classclass ClubMember: #__init_ functiondef…
Q: a) Create a data structure, UserStore (.h) to store User objects, with the following features:
A: 1. for getUserById, simply return user id of current instance 2. addUser , simply add this user…
Q: Which of the following are true about polymorphism? A It means many forms or multiple…
A: Concept Concept name it means many forms or multiple transformation Polymorphism it is the…
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: Which of the following statements about Python is true? A. Python does not support inheritance. B.…
A: Answer:- D. Python supports function overloading. Explanation:- Python supports inheritance. Python…
Q: Please add the following to my class in the code and don't make a sepearte one Question: Implement…
A: import edu.princeton.cs.algs4.*;import edu.princeton.cs.algs4.LinearProbingHashST;import…
Q: Write a statement that deletes the two objects of Student type below. p = new Student[2]; %D
A: Given: How to delete objects in C++.
Q: Your class, triangle.cpp, must have the following things: 1. Variables to hold the base and height…
A: We have 3 member functions- 1.input()-in this we are taking input. It is of bool type.…
Q: public abstract class Shape { public Shape() { } public abstract double area() ;…
A: Hey there. The code has been written in java in the next step2. I have made the code bold - texted…
C++
Write a function named “createPayStub” that accepts the number of hours
(integer), and the hourly payrate (double). It will return the pointer to a newly
created PayStub object. If the given hours or payrate is negative, it will return
nullptr. In addition, it also returns the total payout amount to the caller (in the
output parameter).
Please show how this function is called and returning the proper information.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- in C++ Write a function that allows you to modify a Planet in the SolarSystem class. You can choose to pass a Planet into this function, or have the function prompt for planet information. Either way, you need to be able to specify the Planet at a specific index to be modified. This is an example of how it could potentially look in the main: // code that declared a SolarSystem the_system// and assigned planetsPlanet p("X", 2000, 4000);int index = 2;the_system.changePlanet(p, index);C++ Write a function named “createPurchaseOrder” that accepts the quantity (integer), the cost per item (double), and the description (string). It will return a newly created PurchaseOrder object holding that information if they are valid: quantity and cost per item cannot be negative and the description cannot be empty or blank(s). When it is invalid, it will return NULL to indicate that it cannot create such PurchaseOrder object.in C++ Write a function named “createVariableObject” that will read in the variable name, description anda value (string) from the user and create a dynamic Variable or VariableString depending on the value: if the user provides an empty string value, it will create a Variable object, otherwise it will create a VariableString object. It will return the pointer of the newly created object. This function must handle all error cases for invalid variable names entered by theuser: starting with a non-alphabet letter or containing blanks by handling exception usingtry-catch. It will print out proper error message and continue to ask the user forthe new value until it is correct name.Please show how this function is being tested andprint out the correct variable information.
- C++ printSmaller is a function that accepts two int parameters and returns no value. It will print the value of the smaller one parameters. The function protoype is as follows: void printSmaller(int num1, int num2); write the statments to read two integers and call this function to display the smaller one.C++ Write a function named “createPurchaseOrder” that accepts the quantity(integer), the cost per item (double), and the description (string). It will return anewly created PurchaseOrder object holding that information if they are valid:quantity and cost per item cannot be negative and the description cannot be empty or blank(s). When it is invalid, it will return NULL to indicate that it cannot create such PurchaseOrder object. PurchaseOrder createPurchaseOrder(int quantity, double costPerItem, string description) { if(quantity < 0 || costPerItem < 0.0 || description == "") return NULL; else { PurchaseOrder p = new PurchaseOrder(quantity,costPerItem,description); return p; } } what's the issue with this function and how to rewrite itInstructions: In the code editor, you are provided with the definition of a struct Person. This struct needs an integer value for its age and a character value for its gender. Furthermore, you are provided with a displayPerson() function which accepts a struct Person as its parameter. In the main(), there are two Persons already created: one Male Person and one Female Person. Your task is to first ask the user for the age of the Male Person and the age of the Female Person. Then, define and declare a function called createKidPerson() which has the following definition: Return type - Person Name - createKidPerson Parameters Person father - the father of the kid to be created Person mother - the mother of the kid to be created Description - creates a new Person and returns this. The age of this Person will be set to 1 while its gender will be set based on the rules mentioned above. Finally, create a new Person and call this createKidPerson() in the main and then pass this newly…
- A prime number is an integer value that is only divisible by 1 and itself. 2, 3, 5, 7, and 11 are examples of prime numbers. You have been provided with two function definitions: The is_prime () function takes an integer parameter number, and returns True if number is prime and False otherwise. The get_next_prime () function also takes a single integer parameter number, and returns the first prime number larger than it. You must not change the implementation of these 2 functions. Complete the get_primes_list() function that takes a single list of integers called numbers as parameter. You can assume that the integer items in this list will be non-negative. The function must update this list so that items that are not prime numbers are updated to the first prime number larger than them. To implement this function you must call both the is_prime () and get_next_prime () functions. Some examples of the function being called are shown below. Note: the get_primes_list() function does not…C++ Create a class Rectangle. The class has attributes length and width, each of which defaults to 1. It has member functions that calculate the perimeter and the area of the rectangle. It has setter and getter functions for both length and width. The program should ASK THE USER TO INPUT length and width value. The set functions should verify that length and width are each floating-point numbers larger than 0.0 and less than 20.0. A sample output of your program should look like follows: length = 1.0; width = 1.0; perimeter = 4.0; area = 1.0 another example: length = 5.0; width = 4.0; perimeter = 18.0; area = 20.0 There should be three files and ONE class only. .h file contains class definition, .cpp file contains the implementation of the class in .h file and main.cpp should contain the driver code.PROGRAMMING LANGUAGE: C++ You need to store hiring date and date of birth for teachers, and for students store their admission date and date of birth. You need to create a Date class for this purpose. Create objects of Date class in Teacher and Student class to store respective dates. You need to write print function in Teacher and Student classes as well to print all information of Teachers and Students. You need to perform composition to implement this task. Create objects of Teacher and Student classes in main function and call print function for both objects. Print Date class here. Print updated Teacher class here. Print updated Student class here. Print main function here. Print Outputshere.
- In C++ Write the definition of a void function that has two parameters: an array, and an integer parameter that specifies the number of elements in the array. The functions swaps the first and last elements of the array.In C++ Write a function named find_bigfoot which takes a string as an argument, and then determines whether the string "bigfoot" is found in the parameter. Then it returns true or false, depending on whether it was found or not. For example: find_bigfoot("There is no yeti");find_bigfoot("footbig not here"); would both return false, since the string bigfoot isn't part of the string while: find_bigfoot("I believe in bigfoot");find_bigfoot("bigfoot is around here"); would both return true, since the string bigfoot is part of the string.Using C++ Language In this program you will write a function of void return type named compare that accepts an integer parameter named guess. This function will compare the value of guess with a seeded randomly generated integer between 1 to 100, inclusive, and let the user know what the random number was as well as whether the guess was larger than, smaller than or equal to the random number. NOTE THAT: You will NOT generate a random number inside the compare function. Rather, you will write another function named getRandom of int return type to do it. You will need to call getRandom from compare, no parameters are necessary. Inside your main function, get the guess from user and pass it to the compare function. Code: #include <iostream>using namespace std; int getRandom(){ //generate seeded random num. //in between 1-100 inclusive //return random number } void compare(int guess){ //call getRandom //compare guess with random number //inform user what…