1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
LekaFEV [45]
2 years ago
14

There Are Two Programs in this Question who will attempt first i will give brainliest ans reward and big points:-

Computers and Technology
1 answer:
Korolek [52]2 years ago
4 0

Answer:

here you go ,could only do Question 2.try posting question 1 seperately maybe someone else can also try to help

Explanation:

Question 2.

#include <iostream>

using namespace std;

// class BankAccount

class BankAccount{

  

    // instance variables

    private:

        int accountID;

        int balance;

  

    public:

      

        // constructor

        BankAccount(int accountID, int balance){

            this->accountID = accountID;

            this->balance = balance;

        }

      

        // getters and setters

        void setAccoutnId(int accountID){

            this->accountID = accountID;

        }

      

        int getAccountId(){

            return accountID;

        }

      

        void setBalance(int balance){

            this->balance = balance;

        }

      

        int balanceInquiry(){

            return balance;

        }

};

class CurrentAccount : public BankAccount{

  

    public:

  

        // constructor

        CurrentAccount(int accountID, int balance):BankAccount(accountID,balance){

          

        }

      

        // function amount to withdraw

        void amountWithdrawn(int amount){

            setBalance(balanceInquiry()-amount);

        }

      

        // function to deposit amount

        void amountDeposit(int amount){

            setBalance(balanceInquiry()+amount);

        }

};

class SavingsAccount : public BankAccount{

  

    public:

      

        // constructor

        SavingsAccount(int accountID, int balance):BankAccount(accountID,balance){

          

        }

  

        // function amount to withdraw

        void amountWithdrawn(int amount){

            setBalance(balanceInquiry()-amount);

        }

      

         // function to deposit amount

        void amountDeposit(int amount){

            setBalance(balanceInquiry()+amount);

        }

      

      

};

int main()

{

    // calling function of Current Account

    cout<<"Current Account : "<<endl;

    CurrentAccount current(122,100000);

    current.amountWithdrawn(10000);

    cout<<"Your balance after withdraw : ";

    cout<<current.balanceInquiry()<<endl;

    current.amountDeposit(30000);

    cout<<"Your balance after deposit : ";

    cout<<current.balanceInquiry()<<endl;

    cout<<endl<<endl;

  

    // calling function of Savings Account

    cout<<"Savings Account : "<<endl;

    SavingsAccount saving(125,80000);

    saving.amountWithdrawn(5000);

    cout<<"Your balance after withdraw : ";

    cout<<saving.balanceInquiry()<<endl;

    saving.amountDeposit(20000);

    cout<<"Your balance after deposit : ";

    cout<<saving.balanceInquiry();

    return 0;

}

You might be interested in
Do you agree that digital signatures are the best way to protect the data in question?
lutik1710 [3]

Answer:

Explained

Explanation:

Yes, I agree that digital signatures are the best way to protect the data in the date in question. A digital signature is mathematical technique used to validate the authenticity and integrity of a massage. Digital signature is far more inherent security. It is built to solve problems of tempering and impersonation of digital documents. It allows the authorized user to have authentic right, and the unauthorized person is denied access.

3 0
2 years ago
If a firm is set to use open-source software with which no one in the IT department is familiar, what should it do? fire the IT
Aleonysh [2.5K]
The most efficient thing to do would be to provide training as firing or doing nothing halts productivity indefinitely while training eventually will finish
7 0
2 years ago
Read 2 more answers
Why coaxil cable called coxial cable ?
Reika [66]

Answer: Coaxial Cable has got two physical channel layer in same axis of the cable that is why it is known as "coaxial cable".

Explanation: Coaxial cable is the main example for television cable and telephone cable that have two physical layer of channels and are separated by a insulating material layer and the outer layer working a ground section.The axis of both the physical layer are present on the same axis of the cable and thus is known as coaxial cable. They cable is usually made up of copper and some other materials.

7 0
3 years ago
Read 2 more answers
Write a Java program to accept an item's name and price from the user and output them to the console
Anit [1.1K]

Answer:

// program in java.

// package

import java.util.*;

// class definition

class Main

{// main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // scanner object to read inputs

Scanner scr=new Scanner(System.in);

 // variables

String name;

   double price;

   System.out.print("Enter item's name: ");

   // read item's name

   name = scr.next();

   System.out.print("Enter item's price: ");

   // read item's price

   price= scr.nextDouble();

   // print name

   System.out.println("name of item is:"+name);

   // print price

   System.out.println("price of item is:"+price);

   }catch(Exception ex){

       return;}

}

}

Explanation:

Read name & price of item from user and assign it to variables "name" & "price" respectively with scanner object.Then print the name and price of item .

Output:

Enter item's name: Apple                                                                                                  

Enter item's price: 100                                                                                                    

name of item is:Apple                                                                                                      

price of item is:100.0

6 0
2 years ago
Please write a complete program to calculate monthly payment given
jasenka [17]

Explanation:

Code with comments:

#include <stdio.h>

#include <math.h>  

/* math library is required to use pow() function

First we need to create a function to calculate the Monthly Payment

It would take three inputs Rate, Years, and Principle amount

Then we converted the Rate and Months according to problem statement

pow() function is used to find (1+R)^M

Then finaly this function returns the value of Monthly Payment  */

float MonthlyPay(float R, int M, int P)

{

    R=R/1200;

    M=M*12;

   float po=pow((1+R),M);

   float PayM=(R+(R/(po-1)))*P;

    return PayM;

}

/*  In the main() function we get 3 inputs from the user Years, Rate and Principle amount

then we call the MonthlyPay function and pass it 3 inputs that we got from the user

then we calculated the total Payment by multiplying the Monthly Pay and total number of months

then we calculated the interest Amount by subtracting the Principle Amount from total Pay

Testing is performed and output result is given at the end and also attached in the image   */

int main(void)

{

    float Rate;

    int Year, Amount;

    printf("Enter Years: ");

    scanf("%d",&Year);

    printf("Enter Rate: ");

    scanf("%f",&Rate);

    printf("Enter Principle Amount: ");

    scanf("%d",&Amount);

   

    float Pay = MonthlyPay(Rate, Year, Amount);

    printf ("Monthly Payment is: %f \n", Pay);

    float totalPay=Pay*Year*12;

    printf ("Total Payment is: %f \n", totalPay);

    float interest=totalPay-Amount;

    printf ("Interest Expense is: %f \n", interest);

    return 0;

}

Output:

Enter Years: 5

Enter Rate: 7

Enter Principle Amount: 12200

Monthly Payment is: 241.572767

Total Payment is: 14494.367188

Interest Expense is: 2294.367188

7 0
3 years ago
Other questions:
  • What part of the computer gives access to the internet
    10·1 answer
  • What is the problem with assigning a port number to more than one server application?
    8·1 answer
  • Which of the following best explains the concept of a prototype
    10·1 answer
  • QUESTION: Which is not an example of a video port or cable?
    10·1 answer
  • What is an individual section machine?
    14·1 answer
  • 50 POINTS &amp; A FOLLOW!
    11·2 answers
  • Which functions are examples of logical test arguments used in formulas? Check all that apply. OR IF SUM COUNT NOT AND
    12·2 answers
  • Computer technology has changed our lives write of a least five ways to show how this is so​
    15·1 answer
  • A website for a certain political party or candidate is likely to have unbiased
    6·1 answer
  • Chris is working with other employees on a worksheet. the other employees have made comments, but they are not visible.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!