Mini Project Mini Project MSCM 1053 Computational Mathematics ATM Machine Simulate an ATM machine: Prompt for userid and password. If userid and password are not in the database, reprompt. Display...

It should be on visual studio 2019 or on visual studio 2017. Have to submit on time. Find the four attached file. If you need more support material, tell me.




Mini Project Mini Project MSCM 1053 Computational Mathematics ATM Machine Simulate an ATM machine: Prompt for userid and password. If userid and password are not in the database, reprompt. Display balance. Present a menu asking to deposit, withdraw or exit. If user selects withdraw or deposit, perform the indicated transaction and goto Step 2. Deny withdrawals that would overdraw the account. Exit the program. Use necessary input data to simulate the system. You may add any additional relevant item to the system, and use your creativity to design the interface. PowerPoint Presentation MSCM1053 CHAPTER 1: C++ Visual with MFC SHAZIRAWATI MOHD PUZI DEPT. OF MATHEMATICAL SCIENCES, FS UTM 1 MSCM1053 COMPUTATIONAL MATHEMATICS 1 Overview 1.1Intro to Microsoft Foundation Class (MFC) 1.2 References MSCM1053 COMPUTATIONAL MATHEMATICS 2 1.1 Intro to MFC MSCM1053 COMPUTATIONAL MATHEMATICS 3 A set of about 200 C++ classes developed by Microsoft Corp to make windows programming easier and faster To present the display output in a graphical form, instead of ms-dos windows (the black window) User-friendly, meaningful intrepretation 3 MSCM1053 COMPUTATIONAL MATHEMATICS 4 MSCM1053 COMPUTATIONAL MATHEMATICS 5 MSCM1053 COMPUTATIONAL MATHEMATICS 6 What you have seen in previous slides is basically what we called Graphical User Interface (GUI) We saw buttons, input boxes and an output box in a window How do we define a window? How do we define buttons? How do we define input and output boxes? Click on a button and something happens How do we program that action? How do we connect our code to the button? You type something into a input box How do we get that value into our code? How do we convert from a string to numbers? We saw output in the output box How do we get the values there? Lines appeared in our window How do we store the lines? How do we draw them? 1.2 References Shaharuddin Salleh, C++ Visual Simulation, 2016 Edition. Bjarne Stroustrup, Programming: Principles and Practice Using C++, Addition-Wesley, 2014. http://www.tcnj.edu/~scott/CSC215/C++Lectures.html MSCM1053 COMPUTATIONAL MATHEMATICS 7 PowerPoint Presentation MSCM1053 CHAPTER 2: MFC Visualization SHAZIRAWATI MOHD PUZI DEPT. OF MATHEMATICAL SCIENCES, FS UTM 1 MSCM1053 COMPUTATIONAL MATHEMATICS 1 Overview 2.1Microsoft Foundation Class (MFC) 2.2 Graphics Device Interface (GDI) 2.3 My First Windows Program 2.4 Improving The Text Output 2.5 Drawing Graphics 2.6 References MSCM1053 COMPUTATIONAL MATHEMATICS 2 2.1 MFC MSCM1053 COMPUTATIONAL MATHEMATICS 3 Important element in MFC: Window: rectangular work area for purposes like collecting input from the user and displaying output. Class: each MFC class has several functions for things like displaying text and graphics, creating dialog windows and managing the events in a window. The name of a class in MFC is preceded by the letter C. 3 MSCM1053 COMPUTATIONAL MATHEMATICS 4 MSCM1053 COMPUTATIONAL MATHEMATICS 5 2.2 GDI Device Context – object that defines a set of text, graphic and image objects, and their attributes. GDI ObjectClassDescription PenCPenTo draw a line, rectangle, circle, polyline, etc. BrushCBrushTo brush a region with a color. Color paletteCPaletteColor palettes for pens and brushes. FontCFontTo create a font for the text. BitmapCBitmapTo store a bitmap object. MSCM1053 COMPUTATIONAL MATHEMATICS 6 Windows Work Area – a window is made up of small rectangular units called pixels that are organized into columns and rows. In a typical window of 800x600, there are 800 columns and 600 rows of pixels. (0,0) (800,0) (0,600) (800,600) (600,400) MSCM1053 COMPUTATIONAL MATHEMATICS 7 Color Management – controlled by the function RGB(int, int, int) which based on 3 primitive colors; red, green, and blue components. 2.3 My First Windows Program MSCM1053 COMPUTATIONAL MATHEMATICS 8 / CodeV2A.cpp #include "CodeV2A.h" BEGIN_MESSAGE_MAP(CCodeV2A,CFrameWnd) ON_WM_PAINT() END_MESSAGE_MAP() CCodeV2A::CCodeV2A() { Create(NULL,L"CodeV2A: My skeleton Windows",WS_OVERLAPPEDWINDOW,CRect(0,0,1000,700)); } CCodeV2A::~CCodeV2A() { } void CCodeV2A::OnPaint() { CPaintDC dc(this); dc.TextOut(100,50,L"Welcome to Windows..."); } MSCM1053 COMPUTATIONAL MATHEMATICS 9 CCodeV2A::CCodeV2A() { Create(NULL,L"CodeV2A: My skeleton Windows",WS_OVERLAPPEDWINDOW,CRect(0,0,1000,700)); } (0,0) (1000,700) MSCM1053 COMPUTATIONAL MATHEMATICS 10 void CCodeV2A::OnPaint() { CPaintDC dc(this); dc.TextOut(100,50,L"Welcome to Windows..."); } Coordinate to display text 2.4 Improving the Text Output MSCM1053 COMPUTATIONAL MATHEMATICS 11 Text can be formatted for display as a Cstring object using the function Format( ). MSCM1053 COMPUTATIONAL MATHEMATICS 12 MSCM1053 COMPUTATIONAL MATHEMATICS 13 An identifier can also include the width, number of decimal places and method of data alignment. The following table shows some examples. Table 2.6. Some formatting examples in Format(). MSCM1053 COMPUTATIONAL MATHEMATICS 14 CPaintDC dc(this); int i=582; double x=3.04; CString s=”banana”; s.Format(L"%5d%7s%-7s%5.2lf%-5.2lf",i,s,s,x,x); dc.TextOut(300,200,s); MSCM1053 COMPUTATIONAL MATHEMATICS 15 Fonts – By default, font type is Times New Roman with size 12. However, MFC provides a variety of other fonts for selection. Arial of size 20 Bookman Old Style of size 16 Courier of size 12 Gill Sans of size 10 Verdana of size 8 Font can be changed using following command: CFont myFontObject; myFontObject.CreatePointFont(FontSize,FontName); dc.SelectObject(myFontObject); MSCM1053 COMPUTATIONAL MATHEMATICS 16 Example: to create Arial font of size 10 and display a message at (50,100) CFont fArial; fArial.CreatePointFont(10,L”Arial”); dc.SelectObject(fArial); dc.TextOutW(50,100,L”my wonderful Arial”); What else can be done with the text? -change text color  using dc.SetTextColor -change text background color  using dc.SetBkColor MSCM1053 COMPUTATIONAL MATHEMATICS 17 dc.SetTextColor(RGB(0,0,200)); dc.TextOutW(50,150,L"Food, glorious food"); Changing the text color The following code segment displays the Food, glorious food in blue at location (50, 150). Changing the text background color The following code segment displays the Food, glorious food on yellow background at location (50, 150). dc.SetBkColor(RGB(200,200,0)); dc.TextOutW(50,140,L"Food, glorious food"); MSCM1053 COMPUTATIONAL MATHEMATICS 18 Recall Problem Solving 4: Write an MFC program that has the following criteria: Task 1: Generate 10 random numbers, and store them in an array, display the numbers Task 2: Sort the numbers in descending order, display the numbers Task 3: Compute the squared of each number, and find the total of squared number, display the total Tips: Define a class called PS5 which includes the member functions RandNumbers( ), SortNumbers( ), and SqNumbers( ) correspond to each task. MSCM1053 COMPUTATIONAL MATHEMATICS 19 2.5 Drawing Graphics MSCM1053 COMPUTATIONAL MATHEMATICS 20 Line Rectangle Ellipse MSCM1053 COMPUTATIONAL MATHEMATICS 21 Lines are the simplest of the graphics primitives and are therefore the easiest to draw. Lines are painted using the MoveTo( ) and LineTo( ) functions, which set the current position and draw a line connecting the current position to a specified end point, respectively. dc.MoveTo(250,280); dc.LineTo(100,340); Line MSCM1053 COMPUTATIONAL MATHEMATICS 22 dc.MoveTo(50,300); dc.LineTo(50,340); dc.LineTo(130,340); dc.LineTo(130,160); dc.LineTo(330,160); dc.LineTo(330,300); MSCM1053 COMPUTATIONAL MATHEMATICS 23 Syntax: CRect rec_name; rec_name=CRect(xLeft, yTop, xRight, yBottom); dc.Rectangle(rec_name); CRect rct; rct=CRect(50,70,150,140); dc.Rectangle(rct); Rectangle MSCM1053 COMPUTATIONAL MATHEMATICS 24 OR CRect rec_name; rec_name=CRect(CPoint(xStart,yStart),CSize(Width, Height)); dc.Rectangle(rec_name); CRect rct; rct=CRect(Cpoint(50,70),CSize(100, 70); dc.Rectangle(rct); MSCM1053 COMPUTATIONAL MATHEMATICS 25 Although they are curved, ellipses are drawn in a manner very similar to rectangles. An ellipse is simply a closed curve, and therefore, it can be specified by a bounding rectangle. CRect rt; rt=CRect(50,100,250,200); dc.Ellipse(rt); How about a circle? Ellipse Practice: Page 52, no. 11 MSCM1053 COMPUTATIONAL MATHEMATICS 26 MSCM1053 COMPUTATIONAL MATHEMATICS 27 home (x,y) Width=70 height=40 rct=CRect(CPoint(home),CSize(width, height); How do we define home? MSCM1053 COMPUTATIONAL MATHEMATICS 28 home, horizontally: Row 1: (50,60) (150, 60) (250, 60) (350, 60) etc Row 2: (50, 140) (150, 140) (250, 140) (350, 140) etc Row 3: (50, 220) (150, 220) (250, 220) (350, 220) etc X: 50+(width+30)*(j-1) Y: 60+(height+40)*(i-1) home=CPoint(50+(width+30)*(j-1), 60+(height+40)*(i-1)) 2.6 References Shaharuddin Salleh, C++ Visual Simulation, 2016 Edition. Bjarne Stroustrup, Programming: Principles and Practice Using C++, Addition-Wesley, 2014. http://www.tcnj.edu/~scott/CSC215/C++Lectures.html MSCM1053 COMPUTATIONAL MATHEMATICS 29 CObject CCmdTarget CException CFile CDC CView CDialog CFrameWnd CGdiObject CPen CBrush CBitmap CFont CPalette CPaintDC CClientDC CWindowDC CEditView CListView CTreeView CCtrlView CEdit CListBox CComboBox CButton CHotKeyCtrl CStatic CScrollBar CTabCtrl CSliderCtrl CWnd CObject CCmdTargetCExceptionCFileCDC CViewCDialogCFrameWnd CGdiObject CPen CBrush CBitmap CFont CPalette CPaintDC CClientDC CWindowDC CEditView CListView CTreeView CCtrlView CEdit CListBox CComboBox CButton CHotKeyCtrl CStatic CScrollBar CTabCtrl CSliderCtrl CWnd Code2A.h #include class CCode2A : public CFrameWnd { public: CCode2A(); ~CCode2A(); afx_msg void OnPaint(); DECLARE_MESSAGE_MAP() }; class CMyWinApp:public CWinApp { public: virtual BOOL InitInstance(); }; CMyWinApp MyApplication; BOOL CMyWinApp::InitInstance(void) { m_pMainWnd = new CCode2A; m_pMainWnd->ShowWindow(m_nCmdShow); return TRUE; } Code2A.cpp Code2A.cpp Displaying a line of formatted text In its simplest form, a string is displayed on Windows using a function called TextOut(). For example, the following code segment displays the message values of x is 9.075000, w is 78 at location (50,120): CString s; double x=9.075; int w=78; s.Format(L”values of x is %lf, w is %d”,x,w); dc.TextOut(50,120,s); Formatted Text Table 2.5. Some identifiers in Format(). Identifier Variable Type %c Character %s String %d Integer %f Float %lf Double CString s; int a=76; double x=5.275; s.Format("a is %d, x is %lf\n",a,x); dc.TextOut(50,85,s); a is 76, x is 5.275 CString s; int a=76; double x=5.275; s.Format("a is %d, x is %lf\n",a,x); dc.TextOut(50,85,s); a is 76, x is 5.275 Identifier Description %5d 5 spaces of decimal and right -aligned %-7s 7 spaces of string and left -aligned %5.2lf 5 spaces of double with 2 decimal places, right -aligned %-5.2lf 5 spaces of double with 2 decimal place s, left-aligned Identifier Description %5d 5 spaces of decimal and right-aligned %-7s 7 spaces of string and left-aligned %5.2lf 5 spaces of double with 2 decimal places, right-aligned %-5.2lf 5 spaces of double with 2 decimal places, left-aligned %5d %7s %-5.2lf %5.2lf %-7s 5 8 2 b a n a n a b a a n a n 3 . 0 4 3 . 0 4 %5d%7s %-5.2lf%5.2lf%-7s 582bananabaanan3.043.04 PowerPoint Presentation MSCM1053 CHAPTER 3: Dialog, Button and Keyboard SHAZIRAWATI MOHD PUZI DEPT. OF MATHEMATICAL SCIENCES, FS UTM 1 MSCM1053 COMPUTATIONAL MATHEMATICS 1 Overview 3
May 11, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here