Create a struct point to represent a point in cartesian coordinate system
provide member functions
default constructor
input
output
distance(returns the distance between two point objects, the function takes one object as an argument)
is zero(determines if a point is the center)
midlepoint (computes the middle point of an object from origin and returns the answer in a point object)
is equal to(compare two points)
isGreater than (compares two point in terms of the distance from the center)
write a pseudocode to output sum
Write a C program that read numbers from an integer array and graph the information in the form of bar chat. Sample output is given below.
Element Value Histogram
0 19 *******************
1 3 ***
2 15 ***************
3 7 *******
4 11 ***********
5 9 *********
6 13 *************
7 5 *****
8 17 *****************
9 1 *
NuMetro has a special on movies for all members of the public but special discounts for students and pensioners. If
pensioners or students buy a movie ticket they receive 10% if they buy a movie and popcorns, they receive 20%
discount. Other customers only receive a discount when they buy a movie ticket and popcorn; there is no discount for
just a movie ticket alone.
Write a program named question5b.cpp that will consist of two functions. The program must prompt the user for type of
customer (‘p’ for pensioner, ‘s’ for student, ‘o’ for other). It must then call the relevant function according to that entry.
The first function must receive the customer type and calculates discount for pensioners and students. The second
function calculates the discount for customers that are not pensioners or students.
Write a program to calculate and display sum of the following series using for loop x+x2+x3+………xn
Make a struct LINE include appropriate data members.
A line segment includes the endpoints, i.e. the points that it joins.
structure should also provide a function to find the length of the Line
Two lines can be compared to determine which line is shorter and vice versa. Provide function to compare two Lines
Provide appropriate constructors for initialization.
Create a struct point to represent a point in cartesian coordinate system
provide member functions
default constructor
input
output
distance(returns the distance between two point objects, the function takes one object as an argument)
is zero(determines if a point is the center)
midlepoint (computes the middle point of an object from origin and returns the answer in a point object)
is equal to(compare two points)
isGreater than (compares two point in terms of the distance from the center)