Define a class to calculate the electricity bill. The rates of electricity per unit are as follow: If the units consumed are equal or less than 300, then the cost is Rs. 3/- per unit. If unit consumed are more than 300, then the cost is Rs. 3.5/- per unit and a surcharge of 5% of bill is added. Note:Solve this program in c++
Q: Problem 2 of Lab 8: Write a program to help a local restaurant automate its breakfast billing…
A: Program: //Including header file #include<iostream> #include<string> #include…
Q: Define a class to calculate the net pay of an employee. Input the basic pay and calculate the net…
A: The below given Java program will obey the following rubrics: Importing required data package. In…
Q: What is the output of statement B obj = new B(); whereas the definitions of class A and B are…
A: class A { public A() { System.out.println("Default constructor of A is invoked "); }}class B…
Q: Q2.python code Write a class Example to demonstrate 1.Use of Static Variable 2.Print the values of…
A: Python used to answer this question
Q: This activity shall test your knowledge in building classes in Java. For this exercise your need to…
A: The area of the rectangle can be calculated by the product of the length and width of the rectangle…
Q: date into one variable “Duration” of the currenty years.
A: Program: // C++ version 14# include <iostream>#include <ctime>using namespace std;//…
Q: Write the program in python. Write a class called BuildersGame that represents the board for a…
A: Actually, python is a easiest programming language. It is a dynamically typed programming language.
Q: using Java Write a grading program for a class with the following grading policies: 1. There are…
A: #include<iostream>using namespace std;struct record{double quiz1;double quiz2;double midyear,…
Q: in C++ Consider a class Movie that contains the following information about a movie: * Title *…
A: #include <iostream>using namespace std; // declare a classclass Movie { private: string…
Q: Assume that you are applying “testing” and “inspection”, the two defect finding methods in the…
A: The answer is as follows.
Q: c) Analyze the following pieces of code for "class A" and "class B". These pieces of code violate…
A: The given code is not following the proper object-oriented architecture. There are some flaws in the…
Q: Use the class provided, TestOverloadCall printMax to print the highest of 33 and 89Call printMax to…
A: Program:public class TestOverload{ public static void main(String[] args) {…
Q: use the c++ to answer the following quesiton The following class Pizza has incomplete codes.…
A: Answer: a). The following class Pizza has incomplete codes. Write setter and getter methods for all…
Q: Your task is to write a program that computes paychecks. Employees are paid an hourly rate for each…
A: Java is a programming language originally developed by James Gosling at Sun Microsystems (which is…
Q: Please, help to write such a programm in Java! Build a program to work with the Date class. The…
A: Calendar Class in Java Calendar class in Java is a theoretical class that gives strategies to…
Q: Choose the best statement below: Consider the following code: class A { public: virtual…
A: c.) This code compiles, and there is no example of polymorphism in the code.
Q: Write a program in C++ to accept date in dd:mm:yyyy format. Store these values in MyDate Class with…
A: Sample Response: //C++ program to calculate the number of days from Jan 1 to given date on the same…
Q: Make a C# programming with class and methods(pre written class) of: 1. Cody at World Cup by…
A: using System;using System.Collections.Generic;using System.Linq;using…
Q: Write a method drivingCost() with input parameters drivenMiles, milesPerGallon, and…
A: Program code: //import package. import java.util.*; //define main class. public class LabProgram {…
Q: Write a C++ program that prompts the user to enter the earthquake magnitude and outputs its class.…
A: Given 1.MINOR magnitude(0,4) 2.LIGHT magnitude(4,5) 3.MODERATE magnitude(5,6) 4.STRONG…
Q: By implementing the concepts of Classes and Objects, write a C++ program that converts the value of…
A: The variables or objects that are declared normally are stored in Stack and if memory allocation is…
Q: By implementing the concepts of Classes and Objects, write a C++ program that converts the value of…
A: The given problem is to be solved in C++ programming language with a class named Wye2Delta which…
Q: Choose FOUR FALSE statements about friend in C++? O Specifying a regular function as friend to a…
A: The above question is solved in step 2:-
Q: Write a C++ program with classes to find the roots of a degree 2 polynomial ( a x+bx+c%3D0, ). Use…
A: The Complete code is given below with the output.
Q: Design a class named QuadraticEquation for solving a quadratic equation which is of the form…
A: import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner…
Q: Consider the following declaration of class Quad and answer the question below. class Quad int x0,…
A: A class template provides a specification for generating classes based on parameters. Class…
Q: Write a program in C++ to accept date in dd:mm:yyyy format. Store these values in MyDate Class with…
A: Given: Date Function program.
Q: PLZ help with the following: IN JAVA Given the following code where classes AA, BB and Q12 are in…
A: class AA{ int x1; protected int x2; public AA(){ System.out.println("Executing…
Q: Write a program in C++ to accept date in dd:mm:yyyy format. Store these values in MyDate Class with…
A: // File Name: MyDate.cpp #include <iostream> using namespace std; // Defines class MyDate…
Q: Write a C++ program to calculate the area of all classrooms in your college. Most of the classrooms…
A: CODE:- #include <iostream>#include<string.h>using namespace std; int calculateArea(int…
Q: 2. Smith is a course instructor of cpp programming and currently he is teaching conversions to his…
A: If you want to build your own computer, you can go to a hardware store and buy a motherboard, a…
Q: Exercise01. Write a Java program to define and call CalculateAreaCylinder(double height, double…
A: public static double CalculateAreaCylinder(double height, double radius) { double area; area =…
Q: Define a class to calculate the net pay of an employee. Input the basic pay and calculate the net…
A: The below given C++ program will obey the following rubrics: Including necessary header files. In…
Q: Define a class to calculate the net pay of an employee. Input the basic pay and calculate the net…
A: Program in python: def calcualte_gross_salary(basic_pay):…
Q: Write Java program for given scenarios below: Declare a class student with id, name and percentage…
A: one should not ask percentage. But still as per your requirement made java program. define one…
Q: By implementing the concepts of Classes and Objects, write a C++ program that converts the value of…
A: #include<iostream> using namespace std; //class Wye2Delta class Wye2Delta{ double…
Q: Michele is an American tourist. He is now in Jordan to visit Petra and he wants to go shopping, he…
A: Explanation: Variable used in this program US: the number of US dollars held by MicheleJOD: the…
Q: Write java program that meets the following specifications: (use your own example and data values)…
A: Solution: //Java program: //A.java: //creating the class Aclass A { // declaring and initializing…
Q: Write a C++ program to calculate the area of all classrooms in your college. Most of the classrooms…
A: CODE:- #include <iostream>#include<string.h>using namespace std; int calculateArea(int…
Q: Consider the software that runs in an Automated Teller Machine (ATM) machine. One task that must be…
A: Division operator (/): The division operator divides the numerator by a denominator and returns the…
Q: In Python without using super(): Given the base class Book, define a derived class called…
A: class Book: def __init__(self, title, author, publisher, publication_date): self.title =…
Q: Compute the area of the rectangle. Perform an expand function that doubles the dimensions of the…
A: Program code: import java.util.Scanner; class MyRectangle{ int length; int width; public…
Q: Consider the following code snippet. How many times do you expect "In the constructor!" to be…
A: Please find the answer below:
Q: This activity shall test your knowledge in building classes in Java. For this exercise your need to…
A: Objective: A program is designed with a class to construct a Rectangle. The attributes length and…
Q: Read the following JAVA program and answer the questions given at the end.
A: (a) In class Example, there are two types of data members: Instance or non-static data members int…
Q: Write java program that has two class the man class and citizenAcoount class. The program will…
A: Required:
Q: Create a java class named Shipment a. The program must ask for two separate packages to ship b.…
A: Java: Java is a high level, object oriented programming language. It was developed by James Gosling…
Q: Use BlueJ to write a java program that complete the following parts: Create a class named Employee…
A: This is the Employee class and the class is a public class. Now, save this source file with the name…
Q: Consider the software that runs in an Automated Teller Machine (ATM) machine. One task that must be…
A:
Q: 7. Consider the following design for a Product class that keep track of product inventory: public…
A: public class Product { public Product(String name, double qty) { prodName = name;…
Define a class to calculate the electricity bill. The rates of electricity per unit are as follow:
- If the units consumed are equal or less than 300, then the cost is Rs. 3/- per unit.
- If unit consumed are more than 300, then the cost is Rs. 3.5/- per unit and a surcharge of 5% of bill is added.
Note:Solve this program in c++
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making periodic payments over a certain period of time. Of course, the lending company will charge interest on the loan. Every periodic payment consists of the interest on the loan and the payment toward the principal amount. To be specific, suppose that you borrow $1,000 at an interest rate of 7.2% per year and the payments are monthly. Suppose that your monthly payment is $25. Now, the interest is 7.2% per year and the payments are monthly, so the interest rate per month is 7.2/12 = 0.6%. The first months interest on $1,000 is 1000 0.006 = 6. Because the payment is $25 and the interest for the first month is $6, the payment toward the principal amount is 25 6 = 19. This means after making the first payment, the loan amount is 1,000 19 = 981. For the second payment, the interest is calculated on $981. So the interest for the second month is 981 0.006 = 5.886, that is, approximately $5.89. This implies that the payment toward the principal is 25 5.89 = 19.11 and the remaining balance after the second payment is 981 19.11 = 961.89. This process is repeated until the loan is paid. Write a program that accepts as input the loan amount, the interest rate per year, and the monthly payment. (Enter the interest rate as a percentage. For example, if the interest rate is 7.2% per year, then enter 7.2.) The program then outputs the number of months it would take to repay the loan. (Note that if the monthly payment is less than the first months interest, then after each payment, the loan amount will increase. In this case, the program must warn the borrower that the monthly payment is too low, and with this monthly payment, the loan amount could not be repaid.)Define a new C++ class named “PayStub” that manages pay information: numberof hours (integer), hourly pay rate (double).The total payout amount will be calculated based on overtime. Any hour that ismore than 40 hours will be paid at a 1.5 pay rate.For example, with the hourly pay rate of $10.0 and if the number of hours is 40,the payout amount will be 400 and if the number of hours is 50 it will be (40 * 10)+ (10 * 15) = 550Please note that because the payout is a calculated value, it should not be part ofthe data members to make the object as small as possible.The class must provide at least the following two methods: • toString method that returns the string containing all the information aboutthe paystub including the total payout amount.For example, here is the output for different paystubs40 hours at $10.0 an hourHOURS(40) RATE($10.00) PAYOUT($400.00)50 hours at $10.0 an hourHOURS(50) RATE($10.00) PAYOUT($550.00)60 hours at $10.126 an hourHOURS(60) RATE($10.13)…Define a class to calculate the electricity bill. The rates of electricity per unit are as follow: If the units consumed are equal to or less than 300, then the cost is Rs. 3/- per unit. If the unit consumed are more than 300, then the cost is Rs. 3.5/- per unit and a surcharge of 5% of the bill is added. language c++ use object orientated programing
- JAVA write grading program for a class with the following grading policies. thers a total of 2 quizzes, each graded on the basis of 10 points. theeres is 1 midterm exam and one final exam, each graded on the basis of 100 points. final exam counts for 50% of the grade, the midterm counts for 25%, and the 2 quizzes together count for a total of 25%. (Do not forget to normalize the quiz scores.) letter grade will be given based on the following criterion: 90 – 100 A 80 – 89 B 70 – 79 C 60 – 69 D 0 – 59 E program will read student’s scores from a txf file, save them in an arrayor arrays), process the arrays), print the student’s record, which consists of the name, 2 quiz and 2 exam scores as well along with students avg numscore for the course and final letter rade. please noteAll the scores are integers and a student name consists of no more than 10 characters. justify output fileWrite program in C++ Language The other solutions on chegg were incorrect! Please read carefully! Write a program that defines and tests a class called COP3014. The class resembles aclassroom. It has the following grading scheme:3 quizzes 20 points each 20%Mid term 100 points 30%Final 100 points 50%Based on the total grade of any student for the course, the letter grade of each student can becomputed as follows:Any grade of 90 or more is an A, any grade of 80 or more (but less than 90) is a B, any grade of70 or more (but less than 80) is a C, any grade of 60 or more (but less than 70) is a D, and anygrade below 60 is an F.This class needs to have some member variables. The first name, last name, the Z-number, thegrades, the total grade and final letter grade are all considered to be private member variablesof this class.The class should also have the following public member functions/procedural attributes that canbring the objects (students of the class) to life and give them some…This would be for C++ Write a program that calculates a target heart rate. It should have a class called Heart that has a string name and an int age. This class should have getter and setter methods for those member variables. It should also have a method that returns the maximum heart rate which is 220 minus age, a method that returns the maximum target heart rate which is 85% of the maximum heart rate, and a method that returns the minimum target heart rate which is 50% of the maximum. Write a driver program that prompts the user for a name (use getline to get names with spaces) and age and then prints the name, age, maximum heart rate, and the target heart rate. The output needs to be able to recreate the example shown below. Here is an example run of the program would be the following as the assignment shows Please tell me your name: Jake Peralta Please tell me your age: 37 Your name is Jake Peralta Your age is 37 Your maximum heart rate is 183 Your target heart rate is 91-155
- C++ Assume we want to determine the commission received by a salesperson. The commission rate is based on two factors, the amount of sales and the class to which the salesperson belongs. The input will be the sales and the class which the sales person belongs. The output will be the salesperson's name, number and commission. The commission rate will be based on the following: Class =1 If sales is equal to or less than $1000, the rate is 6 percent Class 2= If the sales is less than $1000, the rate is 4 percent. Class 3= If the sales is $1000 or greater, the rate is 6 percentPlease use Python for this problem: Make sure code is in correct format so it can run in Python without any errors and has the correct answer. When you are finished, test your solutions using a doctest: Develop a class Volume that stores the volume for a stereo that has a value between 0 and 11. Usage of the class is listed below the problem descriptions. Throughout the class you must guarantee that: The numeric value of the Volume is set to a number between 0 and 11. Any attempt to set the value to greater than 11 will set it to 11 instead, any attempt to set a negative value will instead set it to 0. This applies to the following methods below: __init__, set, up, down You must write the following methods: __init__ - constructor. Construct a Volume that is set to a given numeric value, or, if no number given, defaults the value to 0. (Subject to 0 <= vol <=11 constraint above.) __repr__ - converts Volume to a str for display, see runs below. set – sets the volume to…Note: It`s python coding 1. Class Implementationa) Implement a class Rectangle with two attributes, width and height.b) Implement an init method with an optional parameter type. Set the default value of the attributes of width and height to 1.c) Implement a display method to print the values of width and height.d) Instantiate two objects of type rectangle, one with arguments one without. r1 = Rectangle(4, 5) r2 = Rectangle()e) Call display() to print width and height.Example OutputWidth: 4Height: 5Width: 1Height: 1
- Using C++ 11 Write a program which overloads fractions arithmetic operations for division. And include the overloading operators which we did in the class like multiplication, comparison, insertion, and extraction operators. Here is the class: class NumDays { int hr; //declaring hour variable to store hours float days; //declaring days variable to store days public: //default constructor NumDays() { hr = 0; days = 0.0; }; // parametrized constructor NumDays(int hrs) { hr = hrs; days = float(hrs / 8.0); }; // implementing getters method to return hours value from class int getHour() { return hr; } // implementing getters method to return no of days from class float getDays() { return days; } // method to implement addition operator NumDays operator + (NumDays obj) { int hrs = getHour() + obj.getHour(); NumDays temp(hrs); return temp; } // method to…C++ Create a program that calculates the cost of construction for building a house for this. Derive a class publicly from three base classes cement, steel and wood. The requirements for building a house will be 500 bags of cement where each bags costs rs150, three tons of steel costing rs 28000 per ton and so on cubic feet of wood costing rs 1500 per cubic foot. PLEASE GIVE CORRECT ANSWER IT WOULD HELP ME ALOT...Rewrite Problem 2 of Lab 8 (Breakfast billing system) using class. Problem 2 of Lab 8: Write a program to help a local restaurant automate its breakfast billing system. The program should do the following: Show the customer the different breakfast items offered by the restaurant. Allow the customer to select more than one item from the menu. Calculate and print the bill Assume that the restaurant offers the following breakfast items (the price of each item is shown to the right of the item): Plain Egg $1.45 Bacon and Egg $2.45 Muffin $0.99 French Toast $1.99 Fruit Basket $2.49 Cereal $0.69 Coffee $0.50 Tea $0.75 Use an array, menuList, of the struct menuItemType, with three components: menuItem of string, menuPrice…