using C++, only pointers data structure, and dynamic memory location. The progra
ID: 3890470 • Letter: U
Question
using C++, only pointers data structure, and dynamic memory location.
The program should simulate a change machine found at the cash register. First, input the amount due and the amount paid from the keyboard. second, print how much change is owed and a number of quarters, dimes,.. etc in change.
Enter cost: 4.57
Enter amount paid: 5.00
out the change owed: 0.43
Quarters:1, Dimes: 1, Nickels: 1, Pennies :3
*1. Consider the following filter circuit, which can be approximated as a cascade connection of a Low-pass and a high-pass filter (under certain conditions): 0 Low-Pass High-Pass a) Find the transfer function, H(s), of the above circuit. b) Assume RI-100 KQ, C 1-10 nF, R2-1 KQ, C2 = 2 nF. Use these values to calculate the numerator polynomials of the transfer function, H(s), and define it in Matlab as follows: >> num = [ ]; den = [ ]; >Hs tf(num,den); Then construct a Bode plot of the above circuit using the following Matlab command: >> bode(Hs) c) What kind of filter is it? What are its approximate cut-off frequencies? d) What is the form of its approximate output due to an input of the form: vdt) = 2-3 sin(4m1 04t-z/3) + 1 .5cos(121 04t) (Note: just give the form) e) If a periodic waveform having a fundamental frequency, fo-4 Khz, is passed throu the above filter, which frequency components are expected to be present at the output?Explanation / Answer
#include <iostream>
using namespace std;
int main()
{
double cost, amountPaid, changeOwed ;
int quarters, dimes, nickles, pennies, changeOwedCheck;
cout << "Enter cost: ";
cin >> cost;
cout<<"Enter amount paid:";
cin >> amountPaid;
changeOwed = amountPaid - cost;
cout<<"out the change owed: "<<changeOwed<<endl;
changeOwedCheck = changeOwed * 100;
quarters = changeOwedCheck/25;
changeOwedCheck = changeOwedCheck % 25;
dimes = changeOwedCheck/10;
changeOwedCheck = changeOwedCheck % 10;
nickles = changeOwedCheck/5;
changeOwedCheck = changeOwedCheck % 5;
pennies = changeOwedCheck;
cout<<"Quarters:"<<quarters<<", Dimes: "<<dimes<<", Nickels: "<<nickles<<", Pennies :"<<pennies<<endl;
return 0;
}
Output:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.