Answered step by step
Verified Expert Solution
Question
1 Approved Answer
ASP.NET ideal spouse age application Plato said that the ideal age of a man's wife is half his own age plus seven; if that were
ASP.NET ideal spouse age application
- Plato said that the ideal age of a man's wife is half his own age plus seven; if that were true the ideal age of a woman's husband would be twice her age minus 14. Write an ASP.NET application that calculates the ideal age of a person's spouse. There will be an input TextBox and two Button server controls. If the user clicks the "I am a male" Button, the application will calculate the age of his wife; if the user clicks the "I am a female" Button the application will calculate the age of her husband.
- Start a new ASP.NET Web Site project and add the following elements on the Web page as follows:
- An appropriate title using a centered heading line (e.g.
,
, etc.) should begin the page (use an embedded style sheet in the section to center this title)
- Find (on the Internet or some other location) or create a "banner style" image appropriate to the application and place it also centered (also using the embedded style sheet) following the heading line; this image file should be placed in a folder named "images" within your Web Site project folder
- Place a formatted horizontal rule (you may choose what type of formatting but also place it in the embedded style sheet) following the image
- Create a table of four rows and one column placing the a TextBox server control (include a descriptive label for the TextBox, e.g. "Enter your age"), two Button server controls (one each for "I am a male" and "I am a female"), and the Label server control each in separate cells; center the table within the Web page (also using the embedded style sheet)
- Update the ID's (names) of the TextBox server control to "TextBoxAge", the two Button server controls to "ButtonMale" and "ButtonFemale", and the Label server control to "LabelResults"
- For either of the Buttons assign the input value from the "TextBoxAge" TextBox to a variable of type int using the appropriate Visual C# conversion method
- Then calculate the output age of the spouse and assign the result to the Label server control with a descriptive label in the format "The ideal age of your wife is 19" or "The ideal age of your husband is 24"
- An appropriate title using a centered heading line (e.g.
- You may receive a possible 9 out 10 points for the assignment as presented in the textbook and above; for full credit (a maximum of 10 possible points), test during the numeric conversion of the input from the "TextBoxAge" TextBox server control is numeric prior to subsequent processing as follows:
- If the input is not numeric, use try ... catch processing to catch the exception and display an appropriate error message to the user within the output Label server control (you may have to go on-line to find out how to implement this functionality but exception handling in C# is exactly the same as it is in Java)
- If the input age is numeric, continue with the specified processing
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started