You are on page 1of 2

MACHINE EXERCISE NO.

Create an MVC Model 2 web application that will request for an input String from the user. The
function of the application is to segregate all input numbers from its input String. If the last
ending number is ODD, then all the input numbers should then be added, else (if EVEN) then all
the input numbers should then be multiplied.

Sample input (HTML form)

Enter a String: a6s.,<Mv3d4_34(()2^&24!5

Submit button

Clicking the submit button will then perform the operations listed above.

Sample output (JSP)

Input numbers are: 6 3 4 3 4 2 2 4 5

Summation value: 33

View Counter Results

View Input History

Go Back

Clicking the GO BACK (either button or hyperlink) will go back to the form.

All results must be stored on tables Numbers and NumberCount.

ICS2609: Machine Exercise No. 2


Details are as follows:

For Numbers table


id int (PK)
inputString varchar (150)
value bigInt
result bigInt

For NumberCount – there is only one record that must exist. Attributes:
id int (PK, auto-increment)
oddCounter int
evenCounter int

Note – the oddCounter and the evenCounter will start with an initial value of zero (0).

The ViewCounterResults hyperlink will display the counter values from the NumberCount table.

Sample output of ViewCounterResults

Odd: 3
Even: 5

Sample output of View Input History

ID Input String Value Result


1 .,<Mv3d4_34(()2^&24!5 634342245 33
2 .. .. ..
3 .. .. ..
4 .. .. ..

ICS2609: Machine Exercise No. 2

You might also like