Write an interactive Python calculator program. The program should allow the user to type in a mathematical expression, and then it should evaluate and print the resultant value of the expression. Include a loop so that the user can perform many calculations one after the other.
To quit early, the user can make the program crash by typing a bad expression (e.g., (2 + 2) * 5 ! 4) (You’ll learn better ways of terminating interactive programs in later lessons) or a user can terminate it simply by entering Quit as sentinel value.
Write a temperature converter program that uses lambda functions to convert from Fahrenheit to Celsius and vice versa.
Q1: Write a class named as Bus that contains the attributes which are mentioned below:
The name of Bus.
The direction of Bus (North (N), South(S), East(E), West (W))
The position of Bus (from imaginary zero point)
The class has the following member functions:
A constructor to initialize the attributes
Turn function to change the direction of bus to one step right side (e.g if the direction is
to East, it should be changed to South and so on)
Overload the Turn function to change the direction to any side directly. It should take the
direction as an argument.
Move function to change the position of the Bus away from imaginary zero point. It
should accept the distance as an argument.
Write a temperature converter program that uses lambda functions to convert from Fahrenheit to Celsius and vice versa.
What if two classes for example “Human and Hospital” are friend classes, which
member functions of these classes have access to the private and protected members of each
class. Write a program in C++ to differentiate these classes.
Write a function distance that calculates the distance between two points (x1, y1) and (x2, y2). All numbers and return values should be of floating type. Use this function in your program. The values of the points shall be provided by the end user.
Write an interactive Python calculator program. The program should allow the user to type in a mathematical expression, and then it should evaluate and print the resultant value of the expression. Include a loop so that the user can perform many calculations one after the other.
To quit early, the user can make the program crash by typing a bad expression (e.g., (2 + 2) * 5 ! 4) (You’ll learn better ways of terminating interactive programs in later lessons) or a user can terminate it simply by entering Quit as sentinel value
Create a class: “Question 1” with data members: 1D integer array of maximum size: 100, n (int). Create a dynamic constructor which takes input of n and n no. of array elements. Apart from taking input this class also displays the maximum and minimum elements from the given array elements.
Write a class named as Bus that contains the attributes which are mentioned below:
The name of Bus.
The direction of Bus (North (N), South(S), East(E), West (W))
The position of Bus (from imaginary zero point)
The class has the following member functions:
A constructor to initialize the attributes
Turn function to change the direction of bus to one step right side (e.g if the direction is
to East, it should be changed to South and so on)
Overload the Turn function to change the direction to any side directly. It should take the
direction as an argument.
Move function to change the position of the Bus away from imaginary zero point. It
should accept the distance as an argument
Write a class named as Bus that contains the attributes which are mentioned below:
The name of Bus.
The direction of Bus (North (N), South(S), East(E), West (W))
The position of Bus (from imaginary zero point)