Write a program that models 2 vehicles (Car and Truck) and will be able to simulate driving and refueling them in the summer. Car and truck both have fuel quantity, fuel consumption in liters per km and can be driven given distance and refueled with given liters. But in the summer both vehicles use air conditioner and their fuel consumption per km is increased by 0.9 liters for the car and with 1.6 liters for the truck. Also the truck has a tiny hole in his tank and when it gets refueled it gets only 95% of given fuel. The car has no problems when refueling and adds all given fuel to its tank. If vehicle cannot travel given distance its fuel does not change.
Q: Write a program that produces images of Christmas trees as output. It should have a method with two…
A: Given: Write a program that produces images of Christmas trees as output. It should have a method…
Q: Implement the design of the Passenger class so that the following output is produced: The assumption…
A: In Python, For counting the number of objects created of this class, we only need one class…
Q: Write a program to simulate showing an NBA Team on a Basketball court. Here is an example of the…
A: Given Data:- The code is given below on step 2
Q: Write a program to grade students based on scores out of 100 and also print a teacher comment. If…
A: I give the code in Python along with output and code screenshot
Q: Write a program that plays a guessing game with the user. The user should pick a letter, and the…
A: GIVEN: Write a program that plays a guessing game with the user. The user should pick a letter, and…
Q: Imagine that you are managing a plant, and measure production each day. Production is in number of…
A: prod = 1list=[]day=1#taking input and appending in listwhile prod > 0: prod=int(input("Please…
Q: Write a program with total change amount in pennies as an integer input, and output the change using…
A: Java Code: import java.util.Scanner; public class LabProgram { public static void…
Q: Write a program using if, and elif and else, that asks the user what their favorite food is. Then…
A: We need to read a string and compare the string with list of favorite food.
Q: Write a program that will check and print if the person is a regular passenger, student or senior…
A: Program Code: #include<stdio.h>#include<conio.h>main(){ int ch,fare; printf("If you are…
Q: Write a program that creates a model that uses the percentage of individuals with bachelor's degrees…
A: CSV files are simply comma separated value files. In the given 'internetusage.csv' file, data is…
Q: Write a program that will ask a user to input grades in Integral Calculus, Computer Programming and…
A: The given code is in Python.
Q: Write a program that reads a word and prints whether it is short (fewer than 5 letters). • it is…
A: #include<iostream> #include<iomanip> #include<string> using namespace std; int…
Q: Write a program that accepts a year written as a four-digit Arabic (ordinary) numeral and outputs…
A: Code in C++: #include<iostream>using namespace std;int main(){ //declaring required…
Q: By implementing the concepts of Classes and Objects, write a C++ program that determines the…
A: Algorithm: Start Create a class Motion with v0,theta,t as its members using constructor and…
Q: Write a c++ program that plays a game with a single die (or dice). Each number on the die is…
A: function main: Start declare dice, sum =0 declare user_choice do for i = 1 to 5 folow step 6…
Q: Write a program that models 2 vehicles (Car and Truck) and will be able to simulate driving and…
A: This is an object oriented programming concept in which concepts like inheritance, polymorphism are…
Q: Write a program that can be used by a small theater to sell tickets for performances. The theater’s…
A: Introduction: In this question, we have to write a program that asked for the prices of each seat of…
Q: Implement a Python class for the Tweet ADT with an instance variable for storing the text and a…
A: Python program to solve the given problem.
Q: Write a computer program to model the motion of a spacecraft of mass 150000 kg that is launched from…
A: Answer
Q: Implement a class Moth that models a moth flying along a straight line. The moth has a position,…
A: public class Moth{ private double position; public Moth(double initialPosition) {…
Q: Write a program that finds the first unmatched closing bracket which either does not have an opening…
A: Python programming is a high-level interpreted programming language, It's also used to build…
Q: Write a program with total change amount as an integer input, and output the change using the fewest…
A: Below is the code in C++ as language not specified and sample output:
Q: Use only switch and if statements only, please.
A: The below given Java program will obey the following rubrics: Importing essential header files.…
Q: Write a computer program to model the motion of a spacecraft of mass 150000 kg that is launched from…
A: Answer
Q: In this lab work, you will implement a coffee shop example. In this coffee shop, everything must…
A: C program #include<stdio.h>#include<stdlib.h>float a;int b,c,d,e,f,sum=0;void milk();…
Q: Write a program that will determine how many coins of each denomination (50kr, 25kr, 10kr, Skr, and…
A: I'm using C++ to code following given question:
Q: Write a program to find the average of three scores. Use one class for each score.
A: Please refer below for your reference: According to question ,I have used a class and a method…
Q: By implementing the concepts of Classes and Objects, write a C++ program that determines the…
A: Given: By implementing the concepts of Classes and objects, write a C++ program that determines the…
Q: Write a program that takes the x, y coordinates of a point in the Cartesian plane and prints…
A: Note: You didn't mention any languages so i use C language//include the header…
Q: Write a program that simulates the normal operation of a modern elevator with 25 floors (levels) and…
A: Answer:)
Q: Write a program FirstToFive that simulates a head-to-head match where two players, Daniel and…
A: I have provided JAVA CODE along with CODE SCREENSHOT and TWO OUTPUT…
Q: Write a program that reads HAND_SIZE cards from the user, then analyzes the cards and prints out the…
A: Given: Write a program that reads HAND_SIZE cards from the user, then analyzes the cards and…
Q: Write a program whose input is two integers, and whose output is the first integer and subsequent…
A: NOTE: - The code is implemented in C language, as programming language is not mentioned. PROGRAM…
Q: Implement the design of the Passenger class so that the following output is produced: The assumption…
A: Passenger class python programming
Q: a program that plays a game with a single die (or dice). Each number on the die is worth a certain…
A: It is defined as Dice (singular die or dice[1]) are small, throwable objects with marked sides that…
Q: Write a program that reads the height h and radius r of Right Circular Cone and finds the surface…
A: In this question, we are asked to create a java program to calculate the surface area and volume of…
Q: By implementing the concepts of Classes and Objects, write a C++ program that determines the…
A: Input : The initial velocity. The angle of projection, in degrees. time Output : Horizontal…
Q: Write a program that displays the classic BINGO game, displays a BINGO card (5x5 square), and tests…
A: I have solve the problem in C++ code with comments for easy understanding :
Q: Write a program that will ask a user to input grades in Integral Calculus, Computer Programming and…
A: Given Code : integral_calc = float(input('Input your grade in Integral Calculus: '))phys =…
Q: Write a program that allows you to play rock,paper, scissors against the computer. When first run…
A: #include <iostream>#include <stdio.h>#include <stdlib.h>#include <ctime>…
Q: Write a java program to help the student to arrange his Diploma Marks of 12 subjects from high to…
A: Ascending order: Sorting the elements of the array from low values to high values is called…
Q: Write a program that simulates picking a card from a deckof 52 cards. Your program should display…
A: Programming language is missing in the question. So we will answer this program in Java language. If…
Q: Create a "tank" class and use it in a program that accepts height and radius from the user and…
A: The class tank will be created using the keyword class. The __init__ function will initialize the…
Q: Write a program which handles a credit card operation. For simplicity, assume that there are only…
A: This is a program which requires the use of arrays. The program illustrates how to use DECLARE, GET…
Q: Write a program that can arrange a group of pebbles into its designated position. We have 4 types of…
A: import java.util.*;public class Main { public static String repeat(char ch, int val){…
Q: Write a program that plays the tic-tac-toe game. Two players take turns clicking an available cell…
A: code: import os#for os based operations gme_bd = [' ',' ',' ',' ',' ',' ',' ',' ',' ',' ']…
Q: Write a program that simulates picking a card from a deck of 52 cards. Your program should display…
A: JAVA Program: public class Main { public static void main(String[] args) { int card = (int)…
Q: Write a program that simulates the normal operation of a modern elevator with 25 floors (levels) and…
A: Algorithm: Start the program. Read the current floor from user. Read the option from user to move…
polymorphism java
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 3 images
- Problem 1. VehiclesWrite a program that models 2 vehicles (Car and Truck) and will be able to simulate driving and refueling them inthe summer. Car and truck both have fuel quantity, fuel consumption in liters per km and can be driven givendistance and refueled with given liters. But in the summer both vehicles use air conditioner and their fuelconsumption per km is increased by 0.9 liters for the car and with 1.6 liters for the truck. Also the truck has a tinyhole in his tank and when it gets refueled it gets only 95% of given fuel. The car has no problems when refueling andadds all given fuel to its tank. If vehicle cannot travel given distance its fuel does not change.Input On the first line - information about the car in format {Car {fuel quantity} {liters per km}} On the second line – info about the truck in format {Truck {fuel quantity} {liters per km}} On third line - number of commands N that will be given on the next N lines On the next N lines – commands in formato Drive…Problem 1. VehiclesWrite a program that models 2 vehicles (Car and Truck) and will be able to simulate driving and refueling them inthe summer. Car and truck both have fuel quantity, fuel consumption in liters per km and can be driven givendistance and refueled with given liters. But in the summer both vehicles use air conditioner and their fuelconsumption per km is increased by 0.9 liters for the car and with 1.6 liters for the truck. Also the truck has a tinyhole in his tank and when it gets refueled it gets only 95% of given fuel. The car has no problems when refueling andadds all given fuel to its tank. If vehicle cannot travel given distance its fuel does not change.Input On the first line - information about the car in format {Car {fuel quantity} {liters per km}} On the second line – info about the truck in format {Truck {fuel quantity} {liters per km}} On third line - number of commands N that will be given on the next N lines On the next N lines – commands in formato Drive…Programming Problem 3 – Broken GPS Consider yourself driving with 60 miles/hour in a city that has only grid like streets, and your GPS is broken. The specifications of the problem are: • With (x, y) as the coordinates of the car, consider the initial position (0,0). • At each intersection, the only directions available are North, South, East or West • The GPS is broken, and it chooses the direction randomly at each intersection, which happens every 5 minutes • The assumption is that the car has the same speed at all times, including when it changes direction and turns. Write a program that calculates the direct distance from the initial point to the location point of the driver after one hour of driving (i.e. the distance between two points). Java Progra
- The flight of a model rocket can be modeled as follows. During the first 0.15 s the rocket is propelled upward by the rocket engine with a force of 16 N. The rocket then flies up while slowing down under the force of gravity. After it reaches the apex, the rocket starts to fall back down. When its downward velocity reaches 20 m/s, a parachute opens (assumed to open instantly), and the rocket continues to drop at a constant speed of 20 m/s until it hits the ground. Write a program that calculates and plots the speed and altitude of the rocket as a function of time during the flight. SOLVE WITH MATLAB PLEASE(C++) A robot is initially located at position (0, 0) in a grid [−5, 5] × [−5, 5]. The robot can move randomly in any of the directions: up, down, left, right. For each move, print the direction of the move and the current position of the robot. If the robot makes a circle, which means it moves back to the original place, print “Back to the origin!” to the console and stop the program. If it reaches the boundary of the grid, print “Hit the boundary!” to the console and stop the program. A successful run of your code may look like: Down (0,-1) Down (0,-2) Up (0,-1) Left (-1,-1) Left (-2,-1) Up (-2,0) Left (-3,0) Left (-4,0) Left (-5,0) Hit the boundary! or Left (-1,0) Down (-1,-1) Right (0,-1) Up (0,0) Back to the origin!C++ Programming Exercise: A real estate office handles, say, 50 apartment units. When the rent is, say, $600 per month, all the units are occupied. However, for each, say, $40 increase in rent, one unit becomes vacant. Moreover, each occupied unit requires an average of $27 per month for maintenance. How many units should be rented to maximize the profit? Write a program that prompts the user to enter: a. The total number of of units. b. The rent to occupy all the units. c. The increase in rent that results in a vacant unit. d. Amount to maintain a rented unit. The program then outputs the number of units to be rented to maximize the profit.
- An oil slick occurs when an underwater refinery pipe ruptures, pumping oil into the water. The spilled oil sits on top of the water and causes a natural disaster. For simplicity, suppose that the oil sits on top of the water in the form of a circle. Write a program that prompts the user to enter the rate at which the ruptured pipe pumps oil (in gallons) per minute, the thickness of the oil on top of the water, and the number of days for which the area is covered by the spilled oil. The program outputs the spilled area (in kilometer) and the volume of oil (in gallons) on top of the water after each day.C++ Demonstration #1; The manager of a football stadium wants you to Write a program that calculates the total ticket sales (number of tickets sold and the total sales amount) after a game given that there are four 'types of tickets-box, sideline, premium, and general admission and the ticket prices are as follows: Premium $250 Box $100 Sideline $50 General Ad $25Construct C++ program to solve a given problem using appropriate programming techniques. Write a program that will calculate and print bills for the city power company. The rates vary depending on whether the use us residential, commercial, or industrial. A code of R means residential use, a code of C means commercial use, and a code of I means industrial use. Any other code should be treated as an error. The rates are computed as follows: R: $6.00 plus $0.052 per kwh used. C: $60.00 for the first 1000 kwh and $0.045 for each additional kwh. I: Rate varies depending on time of usage Peak hours: $76.00 for first 1000kwh and %0.065 for each additional kwh. Off-peak hours: $40.00 for first 1000 kwh and $0.028 for each additional kwh. Your program should prompt the user to enter an integer account number, the use code (type char), and the necessary consumption figures in whole numbers of kilowatt-hours. Your program should display the amount due from the user.
- Task #1 Informatics employees are paid at the overtime rate of one and a half times the base rate for hours worked above 40 hours in a week. Informatics desires a payroll program that reads, for every employee, the base rate and the number of hours worked and prints their weekly wages. It should also print the total of weekly wages paid by informatics. Using pseudocode, develop and algorithm for this problem.Define an enumeration type triangleType that has the values scalene, isosceles, equilateral, and noTriangle. Write a function triangleShape that takes as parameters three numbers, each of which represents the length of a side of the triangle. The function should return the shape of the triangle. (Note: In a triangle, the sum of the lengths of any two sides is greater than the length of the third side.) Write a program that prompts the user to input the length of the sides of a triangle and outputs the shape of the trianglewrite a program in c++ Assume eight employees working at Ziomind Sdn Bhd (Ismail, Atikah, Ravi, Sumaia, Jonathan, Halimah, Salleh, and Khadijah). The working hours are flexible and every employee might work as low as 1 hour or as much as 9 hours per day for 7 days per week. The company would like to prepare a report that displays the number of working hours for each employee per day, the total working hours per week, and the highest working hours in the week achieved by each employee. Write a program that reads the data recorded by the eight employees that contain the following: A one-dimensional array to store the names of the eight employees and a two-dimensional array of eight rows and seven columns of type double to store the seven-day work hours for each employee. A function named read_data() to read data from the user and display the employee’s names and the seven-day work hours. The employee’s name should be stored in the one-dimensional array of type string. A function…