Write a C++ program to report on a vacation trip by car. The program gets its input from a
text file named vacation.txt and writes its ouput to a report.txt file. The vacation.txt file
will contain a pair of numbers on each line. The first number is the number of miles
travelled along a particular route. The second number on the line is the time (in minutes)
that it took to travel that distance. The two numbers on each line are separated by spaces.
Here is an example of a vacation.txt file, but note well that it is only an example. Other
vacation.txt files might contain fewer or more lines, though you can assume that there is
always at least one line of data. Create several such files for testing your program.
5.3 5.5
12.0 10.5
52.5 61.0
Type the expressions below in python interactively, and try to explain what's happening in each case: a. 2 ** 16 2 / 5, 2 / 5.0 b. "spam" + "eggs" S = "ham" "eggs " + S S * 5 S[:0] "green %s and %s" % ("eggs", S) c. ('x',) [0] ('x', 'y') [1] d. L = [1,2,3] + [4,5,6] L, L[:], L[:0], L[-2], L[-2:] ([1,2,3] + [4,5,6]) [2:4] [L[2], L[3]] L.reverse(); L L.sort(); L L.index(4)
Often some situation arises in programming where data or input is dynamic in nature, i.e. the number of data item keeps changing during program execution. A live scenario where the program is developed to process lists of employees of an organization. The list grows as the names are added and shrink as the names get deleted. With the increase in name the memory allocate space to the list to accommodate additional data items. Such situations in programming require which technique. Explain the concept with the help of suitable examples.
Write a program to create a base class: “Question3”, with protected data member: x (int) and with pure virtual function: “Task ()” [Returns no value and takes no argument]. Create a derived class of “Question3” such as “Sub1” (Derive features in public mode). In sub1, there is a member function in public section: get_data1 () to take input for x, and define Task () in this class to display the reverse of x. [Implement the above program by creating pointer to base in main () function and call the necessary functions].
Explain why change is inevitable in complex systems and give examples (apart from prototyping and incremental delivery) of software process activities that help predict changes and make the software being developed more resilient to change.
Create a class home with following data members, area (int), and cost as protected data member. Create a class (with data members as city, state) derived from this bass class home. Enter the detail for 5 objects (derived) and search with state to display all the homes available.
Teacher has prepared the result of a class containing n number of students. He wants to give the award to 3 toppers of the class. Display the Result for 3 toppers as reflected as percentage form in floating type data.
Create a class home with following data members, area (int), and cost as protected data
member. Create a class (with data members as city, state) derived from this bass class home.
Enter the detail for 5 objects (derived) and search with state to display all the homes available.
Write a program which has a class named binary which has a character array to store a binary string The class decimal derives from class binary and contains an integer data member. Another class called octal also derives from binary. Each class should contain constructors and appropriate data members to input and display the elements. The display function of binary class displays the binary equivalent, octal class’s display function displays octal equivalent whereas decimal class’s display function displays the decimal equivalent.
Write a function that calculates the speed of sound (a) in air of a given temperature T (Fahrenheit) which is passed as parameter and returns the speed. Be sure your function does not lose the fractional part of the quotient in the formula shown. Formula to compute the speed in ft/sec:
alpha = 1086sqrt((5T+297)/(247)