Write programs with the following I/O (All calculations must be done in assembly x86)
Input/Output are to be coded in C++
2. All sides are int type
/|\ -------------------------
/ | \ | |
a / | \ b | | width
/ h| \ | |
/ | \ | |
-------------- ------------------------
C length
Enter the values of a,b,c, and h for the triangle: 4 6 9 10
Enter the length and the width of the rectangle: 15 10
Triangle
Area……………………………………45
Perimeter…………………………..19
Rectangle
Area………………………………….150
Perimeter ………………………….50
1.Area & Perimeter of Triangle Program in C++:
#include<iostream>
using namespace std;
int main() {
int height,base,side1,side2,perimeter;
float area;
cout<<"Enter height and base : ";
cin>>height>>base;
area = (0.5)*height*base; //area of traingle
cout<<"Area of triangle is : "<<area;
cout<<"\n";
cout<<"Enter side1,side2 and base : ";
cin>>side1>>side2>>base;
perimeter = side1+side2+base; //perimeter of triangle
cout<<"Perimeter of triangle is : "<<p;
return 0;
}
2. Area & Perimeter of Rectangle program in C++:
#include<iostream>
using namespace std;
int main()
{
int length,width,area,perimeter;
cout<<"Enter length and width : ";
cin>>length>>width;
area = length*width;
perimeter = 2*(length+width);
cout<<"Area of rectangle is :"<<area; // area of rectangle
cout<<"\n";
cout<<"Perimeter of rectangle is :"<<perimeter; // perimeter of rectangle
}
Write programs with the following I/O (All calculations must be done in assembly x86) Input/Output are...
12. Write a C function void rect(int *ar, int *per, int len, int wid) that computes the area ar and perimeter per of a rectangle with length len and width wid. Test it with a main program that inputs the length and width of a rectangle and outputs its area and perimeter. Output the value in the main program, not in the procedure. Sample Input 6 10 Sample Output Length: 6 Width: 10 Area: 60 Perimeter: 32
C++ Write code that will input a number and print the number, the square of the number, and the cube of the number. Continue the operation until 999 is entered. Write code that will request the length and width of a rectangle until 0 is entered for either the length or the width. Print the area and perimeter for each set of inputs. What is the output for the following loop? int number; number = 1; while (number < 11)...
java language
Problem 3: Shape (10 points) (Software Design) Create an abstract class that represents a Shape and contains abstract method: area and perimeter. Create concrete classes: Circle, Rectangle, Triangle which extend the Shape class and implements the abstract methods. A circle has a radius, a rectangle has width and height, and a triangle has three sides. Software Architecture: The Shape class is the abstract super class and must be instantiated by one of its concrete subclasses: Circle, Rectangle, or...
Project Objectives: To develop ability to write void and value returning methods and to call them -- Introduction: Methods are commonly used to break a problem down into small manageable pieces. A large task can be broken down into smaller tasks (methods) that contain the details of how to complete that small task. The larger problem is then solved by implementing the smaller tasks (calling the methods) in the correct order. This also allows for efficiencies, since the method can...
The statement in the following program is in the incorrect order. Rearrange the statements so that they prompt the user to input the shape type (rectangle, circle, or cylinder) and the appropriate dimension of the shape. The program then outputs the following information about the shape: For a rectangle, it outputs the area and perimeter, for a circle, it outputs the area and circumference; and for a cylinder, it output the volume and surface area. After rearranging the statements, your...
JAVA Code Requried Copy the file java included below. This program will compile, but, when you run it, it doesn’t appear to do anything except wait. That is because it is waiting for user input, but the user doesn’t have the menu to choose from yet. We will need to create this. Below the main method, but in the Geometry class, create a static method called printMenu that has no parameter list and does not return a value. It will...
Create a C++ Console project called Lab3a and add the following source document rect_struct.cpp to the project. #include <iostream> #include <iomanip> using namespace std; // This program uses a structure to hold data about a rectangle // PLACE YOUR NAME HERE // Fill in code to declare a structure named rectangle which has // members length, width, area, and perimeter all of which are floats int main() { // Fill in code to define a rectangle variable named box...
For this lab you will be creating a class representing the shape square. A Square is a special case of a Rectangle where both sides have the same length. Rectangle has been provided for your use in this lab. A Rectangle has a height and a width as member variables, two constructors, two member functions, area() and perimeter(), and lastly, an input and output operator. Your Square class should publicly inherit from Rectangle. You will need to update the Constructors...
IN C++ You are to write a program which will get the following variables from the user. Length, Width, Height, Radius, Base. You should also have variables for Pi as 3.14 and choice1 and choice2. Your program will first ask the following: Press 1 to calculate Area Press 2 to calculate Perimeter The choice will be saved in choice1. You should then ask another choice: Press 1 for Rectangle Press 2 for Triangle Press 3 for Circle You have all...
Write MARIE assembly language programs that do the following: I. Write a program that inputs three integers, a, b, and c, in that order. It computes the following ia-bi-fc+ c The result should be written to output 2. Write a program that inputs integers, s. y, and z. It outputs the difference of the langest and first element entered. You may assume x. y, and z all have different values. So if 8, 12, and 9 are input, the output...