Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

could you help me these 5 questions since I do not know how to do this part in C++. The code used for question 2

image text in transcribed

image text in transcribed

image text in transcribed

could you help me these 5 questions since I do not know how to do this part in C++.

The code used for question 2 at below.

------------------------------------------------

/*

* Lab6_2.h

*

* Created on: Sep 11, 2017

* NAME:

* STUDENT No:

*/

#include

#include

class chk{

std::string name;

int acountNo;

float minimum_banlance;

float over_limit_charge;

float balance;

public:

chk(std::string);

void display();

void deposit(float m);

void withdraw(float m);

};

---------------------------------------

/*

* Lab6_2.cpp

*

*

* NAME:

* STUDENT No:

*/

#include "Lab6_2.h"

#include

#include

using namespace std;

chk::chk(string n){

name = n;

minimum_banlance = 1000;

over_limit_charge = 5;

balance = 0;

srand(time(NULL));

acountNo = rand();

}

void chk::display(){

cout

cout

cout

}

void chk::deposit(float m){

balance += m;

}

void chk::withdraw(float m){

if (balance

cout

return;

}

balance -= m;

if (balance

balance -= over_limit_charge;

}

------------------------------------------------------

/*

* Lab6_2_test.cpp

* NANE:

* STUDENT NUMBER:

*/

#include "Lab6_2.h"

#include

using namespace std;

int main(){

// create an acount

chk chk1("John Jone");

// input and select the menu

while(1){

// build the menu

int menu;

cout

cout

cout

cout

cout

cin >> menu;

switch (menu){

case 0:return 0;

case 1:

//display the balance

chk1.display();

break;

case 2:

float m;

cout

cin >> m;

chk1.deposit(m);

break;

case 3:

cout

cin >> m;

chk1.withdraw(m);

break;

}

}

}

//#endif /* LAB4_2_H_ */

e chegg Study l Guided Solut GC?G+????(struct), ?C++ atot() csc1200A (Summer 2018). X Assignment6(1).pdt x ? struc?typedet struct?? x Jian : ? } (D file:///users/Jason/Downloads/Assignment6%20(1).pdf ::?? ?????????.. Learn HTML: Eleme...-3 waschools Online.. Const and in-lines ???? -- 0750 ????? Computer Science G w C++ Language-C- C++ Environment S . ]???? >> Q1 const Write a program in a single cpp file that contains a function main0, name the file const.cpp. In the main function: 1) declare a const integer variable d and try to initialize it at the second line see what is the error Comment this line in order to proceed to the rest steps without compilation error 2) declare a const integer variable c and initialize it to 0; 3) declare a pointer ptr that points to c; print the dereferencing of ptr. 4) try to increase the content of deference ofptr, e.g. ('ptr)++, see what is the error and explain. 5) declare a constant integer array arr initialized to {10, 20,30,40,50); let ptr point to arr and print *ptr and *(ptr+1). 6) declare a constant pointer cptr which points to constant integer arr. 7) try to let cptr point to constant c, see what is the error Q2 const in class Based on lab 6, change the accountNo to constant member variable and change constructors correspondently. Name the program files as Ass6_2.h, Ass6_2.cpp, and Ass6_2_test.cpp Note, to simplify the problem, let's remove all overloaded constructors but leave "chk(std::string,int Q3 in-line functions Based on Q2, change the constructor chk(std::string,int no) and member functions display and deposit into in-line functions

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application And Administration

Authors: Michael Mannino, Michael V. Mannino

2nd Edition

0072880678, 9780072880670

More Books

Students also viewed these Databases questions