Question1) As a software engineer you are asked to write a section of a user friendly interface for the application program. The section intends to multiply two numbers based on a users input string. The numbers could be either real or complex. use inputs which are given below
3x4
5x(6-7i)
(-8+9i)x10
(1+2i)x(-3-4i)
the program should generate the following output:
3x4 =12
5 x (6-7i) = 30 -35i
(-8+9i) x10 = -80 + 90i
(1+2i) x (-3-4i)=5 - 10i
The program must have two classes. Objects belonging to first class must be able to decompose the input strings to correct numerical operator and operands. Objects of the second class must carryout the calculations and display output on the screen.
Question2) Write a program to analyze a pipe-pump network. Create a network class which has a calc_pressure virtual function. For the pipes, the pressure drop is 50 psf per 1000 ft of pipe. For the pumps, the pressure increase is in the input data. Use polymorphism and a single loop to compute the total pressure change. Read the data from file pipe_net.dat (use U for pump and P for pipe.) Print the result to the screen. Make your program capable of handling at least 20 pump-pipe combinations. Sample input data indicating a sequence of for pumps and pipes (the number after the letter indicates either the pressure increase for a pump or the length of the pipe):
U 300 P 800 U 1200 P 1500 U 100 P 3400 U 400 P 6000