Concept explainers
Complete the following
#include <iostream>
using namespace std;
class Yard
{
private:
int length, width;
public:
} ;
Yard ()
{ length = O; width= O; }
void setLength(int 1}
{ 1ength = 1 ; }
void setWidth(int w)
{ width = w; }
int main ()
{
// Finish this program.
}
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
Starting Out with C++: Early Objects (9th Edition)
Additional Engineering Textbook Solutions
C++ How to Program (10th Edition)
Starting Out with C++ from Control Structures to Objects (9th Edition)
Starting Out With Visual Basic (8th Edition)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Starting Out with Python (3rd Edition)
Starting Out With Visual Basic (7th Edition)
- 1. // MAINTENANCE10 // This program accepts data about 100 books and // determines a price for each. // The price is 10 cents per page for the // first 200 pages, then 8 cents // per page after that. // After pricing, all the data is displayed. // Create a Book class and modify the program to use // an array of Book objects instead of individual // data items. start Declarations num SIZE = 100 num sub string titles[SIZE] num pages[SIZE] num prices[SIZE] num MIN_PAGES = 200 num HIGH_PRICE = 0.10 num LOW_PRICE = 0.08 sub = 0 while sub < SIZE output "Enter title … " input title[sub] output "Enter pages … " input pages[sub] if pages[sub]arrow_forwardJVarrow_forwardPseudocode for the student grade calculator program, please Create a program to enter grades and calculate averages and letter grades. Need a class which will contain: Student Name Student Id Student Grades (an array of 3 grades) A constructor that clears the student data (use -1 for unset grades) Get functions for items a, b, and c, average, and letter grade Set functions for items a, n, and c Note that the get and set functions for Student grades need an argument for the grade index. Need another class which will contain: An Array of Students (1 above) A count of number of students in use You need to create a menu interface that allows you to: Add new students Enter test grades Display all the students with their names, ids, test grades, average, and letter grade Exit the program Add comments and use proper indentation. Nice Features: I would like that system to accept a student with no grades, then later add one or more grades, and when all grades are entered, calculate the…arrow_forward
- Create an Organization class. Organization has 10 Employees (Hint: You will need an array of pointers to Employee class) Organization can calculate the total amount to be paid to all employees Organization can print the details(name & salary) of all employees note: write code in main,header and function.cpp filearrow_forwardC++ language Write a menu driven program which has following options:1. Factorial2. Prime or not3. Odd or even4. ExitOnce a menu is selected, the appropriate action should be taken and once this action is finished,the menu should reappear. Unless the user selects the ‘Exit’ option the program should continueto work.Note: Consider array of random numbers from user to find Prime Numbers/Odd/Even and userentered value for factorial.arrow_forwardC# application that will allow users to enter values store all the expenses on that month in an array clothes, food, cool drinks, water, meatarrow_forward
- What does the function f do? struct Point2D { double x; double y; struct Triangle { Point2D v1; Point2D v2; Point2D v3; }; void f(Triangle&t) { } int temp = 12.5; temp = t.v1.x; t.v1.x = t.v1.y; t.v1.y = temp; } int main () { Triangle mytri; mytri.v1.x = 1.0; mytri.v1.y = 22.5; f (mytri); Swaps values of x and y in vertex 1 of an argument of type Triangle Initializes value of x in vertex 1 of an argument of type Triangle Sets all x,y values in all vertices of an argument of type Triangle Swaps value of x in vertex 1 with value of x in vertex 2, for an argument of typearrow_forwardPlease mention what sample runarrow_forward3 E Instructions Write a program named Averages that includes a method named Average that accepts any number of numeric parameters, displays them, and displays their average. For example, if 7 and 4 were passed to the method, the output would be: 74 Average is 5. Test your function in your Main (). Tests will be run against Average () to determine that it works correctly when passed one, two, or three numbers, or an array of numbers. Averages.cs 1 using static System.Console; 2 public class Averages 3 { 4 public static void Main() { +56N 8 O } + } // Write your main herearrow_forward
- Transcribed Image Text JAVA Programming Problem: In the game of "Assassin's Creed", you control a ship with a cannon which is attacking a large enemy Assassin's Creed, armed with many guns. Your goal is to destroy as many of the guns as possible. The battle field is a 2D Cartesian grid, where your cannon is located at the origin. The enemy Assassin's Creed is a horizontal line segment located from the coordinates (X1, Y) to (X2, Y). There are exactly (X2 - X1 + 1) guns on the ship, located at the integer points (X1, Y), (X1+1, Y), ..., (X2, Y). However, the problem is, you cannot always fire at a gun. There are supernatural rocks located at all points of the battlefield whose X and Y coordinates are both integers. In order to fire successfully at an enemy's gun, the line connecting your cannon and that gun must not go through any rocks. Develop a JAVA code to output the number of the enemy battleship's guns that your cannon can destroy. Test Case Result 1 2 2 -2arrow_forwardclass Main { // this function will return the number elements in the given range public static int getCountInRange(int[] array, int lower, int upper) { int count = 0; // to count the numbers // this loop will count the numbers in the range for (int i = 0; i < array.length; i++) { // if element is in the range if (array[i] >= lower && array[i] <= upper) count++; } return count; } public static void main(String[] args) { // array int array[] = {1,2,3,4,5,6,7,8,9,0}; // ower and upper range int lower = 1, upper = 9; // throwing an exception…arrow_forwardLANGUAGE: C++ This is good practice with classes. You are going to create a race class, and inside that class it has a list of entrants (so a list of entry objects) for that race. To test the program you will make an array of three races (so an array of race objects). Populate each race with time and list of entry objects. Print out the schedule. Create a race class that has The name of the race as a character string, ie “RACE 1” or “RACE 2”, The time of the race An array list of entries for that race Create a race array of 3 (or 4) of those race objects, For the list of entries for a particular race that you need above, make a horse entry class (the building block of your array list) you should have The horse name The jockey name The jockey weight Now you need to Populate the structure (ie set up the three races on the schedule, add 2-3 horses entries to each race. You can hardcode the entries if you want to, rather than getting them from the user, just to save the…arrow_forward
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT