Posts

Showing posts from May, 2022

Fundamentals of Computer Programming C++ Programs

Image
  Q1. Add the code on the doted lines in the following program to generate the output given after the source code. Sol: #include<iostream> using namespace std; int main() {           int x=100;           float y=6.0;           float sum;           float product;           float m;           sum=x + y;           cout << "The Sum of x and y is " <<sum<< endl;           product=x*y;           cout<< "The product of x and y is " <<product<<endl;           m=x+y+100; ...

Fundamentals of Computer Programming(Apply computer programming techniques to solve real world problems by Python)

Image
  Question #1: Write a python program that takes balance of a user’s account as input. It should then ask the user how much amount he\she wants to withdraw from his\her account. The program should take this amount as input and deduct from the balance. Similarly , it should ask the user how much amount he\she wants to deposit in his\her account. It should take this amount as input and add to the balance. The program shall display the new balance after amount has been withdrawn and deposited. Note : Your program should have all necessary checks on the transactions. Display a menu to the user to let him\her choose between different available options. Solution: Copy of Source Code: #program to calculate current balance after withdrawal and deposit balance=get=w=d=0 #variables required yn="y" balance=eval(input("Enter your account balance: ")) #input balance #menu for the withdrawal print("For the withdrawal") print(" 1 is to withdra...

Basics of Object Oriented Programming(OOP) Programs

Image
                                        Programs Chapter # 13 :                      Basics Of Object-Oriented programming   Program 13.1                    Write a program that declares a class with one integer data member two members function in () and out () to input and output data in data member .   Program 13.2 Write a class Marks with three data members to store three marks. Write member function in () to input marks, sum () to calculate and return the sum and avg () to calculate and return the average marks. ...