Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java language ! Problem #1: (20 pts Write a method Military Service(char cint age) that takes two parameters, a character (F for female and M

image text in transcribedjava language !

Problem #1: (20 pts Write a method Military Service(char cint age) that takes two parameters, a character (F for female and M for male) and an age, then prints whether the person should serve in the military or not. If the age is 18 or above and the gender is M. the service is mandatory. Write a program that asks the user to enter the age and the gender then displays whcther the scrvice is mandatory or not. Sample Run 1: Enter the age of the user: 20 Enter the gender, F for female and M for male: M The person should serve in the military Sample Run 2: Enter the age of the user: 15 Enter the gender, F for female and M for male: M The person should not serve in the military Sample Run 3: Enter the age of the user: 23 Enter the gender, F for female and M for male: F The person should not serve in the military Sample Run 4: Enter the age of the user: 23 Enter the gender, F for female and M for male: G wrong entry

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions