Top Banner
IT 2033 Object Oriented Programming Menu-driven Application Development Budditha Hettige Department of Computer Science
12

IT 2033 Object Oriented Programming Menu-driven Application Development · 2015-10-27 · Menu-driven Application Development Budditha Hettige Department of Computer Science. Menu

Jul 15, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: IT 2033 Object Oriented Programming Menu-driven Application Development · 2015-10-27 · Menu-driven Application Development Budditha Hettige Department of Computer Science. Menu

IT 2033Object Oriented Programming

Menu-driven Application Development

Budditha Hettige

Department of Computer Science

Page 2: IT 2033 Object Oriented Programming Menu-driven Application Development · 2015-10-27 · Menu-driven Application Development Budditha Hettige Department of Computer Science. Menu

Menu driven Program

• Common application type for the console window

• Program run until user exit from it

• User can select required options

• Use Menu (number input) to select options

27/11/2015 Budditha Hettige ([email protected])

Page 3: IT 2033 Object Oriented Programming Menu-driven Application Development · 2015-10-27 · Menu-driven Application Development Budditha Hettige Department of Computer Science. Menu

Steps to Develop

• Create a menu (to select options)

• Create menu option input method

• Add menu to the application

7/11/2015 Budditha Hettige ([email protected]) 3

do

Menu

getOption

While()

Switch

Page 4: IT 2033 Object Oriented Programming Menu-driven Application Development · 2015-10-27 · Menu-driven Application Development Budditha Hettige Department of Computer Science. Menu

Example

• Create a menu drive application to store Employee details (class example). Your application should support the following menu operations.

– 1. Add new employee (Full time , Contractor or Manager)

– 2. Print all employee details

– 3. Print given employee details

– 4. Exit

_

• Example available on:– https://budditha.wordpress.com/object-oriented-programming-java/

7/11/2015 Budditha Hettige ([email protected]) 4

Page 5: IT 2033 Object Oriented Programming Menu-driven Application Development · 2015-10-27 · Menu-driven Application Development Budditha Hettige Department of Computer Science. Menu

Loop (Main)

7/11/2015 Budditha Hettige ([email protected]) 5

Page 6: IT 2033 Object Oriented Programming Menu-driven Application Development · 2015-10-27 · Menu-driven Application Development Budditha Hettige Department of Computer Science. Menu

Menu

7/11/2015 Budditha Hettige ([email protected]) 6

Menu Options

Page 7: IT 2033 Object Oriented Programming Menu-driven Application Development · 2015-10-27 · Menu-driven Application Development Budditha Hettige Department of Computer Science. Menu

Input Method

7/11/2015 Budditha Hettige ([email protected]) 7

• Can improve this method to avoid invalid input

– public static int getMenuOption(int Max)

Page 8: IT 2033 Object Oriented Programming Menu-driven Application Development · 2015-10-27 · Menu-driven Application Development Budditha Hettige Department of Computer Science. Menu

Main Method

7/11/2015 Budditha Hettige ([email protected]) 8

Value to exit

Page 9: IT 2033 Object Oriented Programming Menu-driven Application Development · 2015-10-27 · Menu-driven Application Development Budditha Hettige Department of Computer Science. Menu

Add New Employee

7/11/2015 Budditha Hettige ([email protected]) 9

Create new full time

Employee

Add new data from keyboard

Increase employee

count

Page 10: IT 2033 Object Oriented Programming Menu-driven Application Development · 2015-10-27 · Menu-driven Application Development Budditha Hettige Department of Computer Science. Menu

Print All Employee Details

7/11/2015 Budditha Hettige ([email protected]) 10

F C M

3

Employee Count

Employee Array

Full time Employee

Contractor

Manager

Page 11: IT 2033 Object Oriented Programming Menu-driven Application Development · 2015-10-27 · Menu-driven Application Development Budditha Hettige Department of Computer Science. Menu

Print given Employee Details

7/11/2015 Budditha Hettige ([email protected]) 11

Page 12: IT 2033 Object Oriented Programming Menu-driven Application Development · 2015-10-27 · Menu-driven Application Development Budditha Hettige Department of Computer Science. Menu

More on application development

• Add error handling method(s) to avoid user errors

• Complete the application

• Build jar file (RUN →Clean and build project [Shift+F11])

• Copy jar file into another location

• Execute Jar file through the command

– Java –jar <jar_file_name>

7/11/2015 Budditha Hettige ([email protected]) 12