Write a C++ program to sum the values in the file with respect to the input of the user. The file contains a set of numerical inputs. Read all the inputs from the file and calculate the sum of odd and even numbers based on the choice of the user.
Sample Format of the file.txt file,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Constraints:
Find the sum of odd numbers if the choice is 1.
Find the sum of even numbers if the choice is 2.
Get the choice from the console and display the output in the console.
Input Format:
Read an integer(choice) as an input from the console.
To sum value from the file, read the content as input from the file (file.txt)
Sample Input and Output 1 :
Enter the choice
1.Odd
2.Even
1
The total of all numbers is 64
Create a class MusicalInstruments which contains methods void play(), String getDescription(),float getPrice().play() need not be given a definition in MusicalInstrument. Derive classes StringInstr and Percurssion from MusicalInstruments. StringInstr contains method, int getNoOfStrings(). Percurssion contains method, String getType(). Create class Violin that inherits from StringInstr. Create class Tabla that inherits from Percurssion.
Write main() to test the classes and to illustrate run-time polymorphism.
In main() create an object of Tabla with appropriate data values and print it.
you have a musical friend ? , If no then sorry you cannot join . If yes , then what instrument you can play , if it is drum or guitar then welcome to the band if none than ,sorry
You cannot join the band .
use string and bool in programming
Create a class MusicalInstruments which contains methods void play(), String getDescription(),float getPrice().play() need not be given a definition in MusicalInstrument. Derive classes StringInstr and Percurssion from MusicalInstruments. StringInstr contains method, int getNoOfStrings(). Percurssion contains method, String getType(). Create class Violin that inherits from StringInstr. Create class Tabla that inherits from Percurssion.
Write main() to test the classes and to illustrate run-time polymorphism.
In main() create an object of Tabla with appropriate data values and print it.
Discuss the conceptual systems design process in the SDLC and the activities in this phase. (10 marks)
Create a program that when run with a name, an integer and a double as CMD arguments, it prints out a greeting using the name and also print the difference of the two given numbers:
Sample run 1:
java Lab01_task85 John 25 18.65
Output: Good day John.
The difference between 25 and 18.650 = 6.35
Create a program that when run with a name, an integer and a double as CMD arguments, it prints out a greeting using the name and also print the difference of the two given numbers:
Sample run 1:
java Lab01_task85 John 25 18.65
Output: Good day John.
The difference between 25 and 18.650 = 6.35