We are going to use JavaScript to consume a service to handle conversions of Inches to Centimeters and Centimeters to Inch.

The service endpoint is http://statenweb.mockable.io/conversions/

You can use this as a starting point https://csc225.matgargano.com/json

Create two separate forms, using Bootstrap.

  • First form:
    • Text input, Button, Result (could be a div, p, etc)
    • Allow a user to enter in a number of inches into the Text Input and when a user clicks on the Button, intercept the form submission event (hint https://www.w3schools.com/jsref/event_preventdefault.asp), reach out to the service, get the proper conversion and output the number of centimeters in the result.
  • Second form:
    • Text input, Button, Result (could be a div, p, etc)
    • Allow a user to enter in a number of centimeters into the Text Input and when a user clicks on the Button, intercept the form submission event (hint https://www.w3schools.com/jsref/event_preventdefault.asp), reach out to the service, get the proper conversion and output the number of inches in the result.

Use jQuery or vanilla javascript to handle the DOM manipulation (outputting the result)

Use axios to make the service request

Notes:

  • You MUST use the service to obtain the conversion rate. The conversion rate is not the important concept to pick up in this assignment, it's knowing how to consume and use a RESTful service
  • Submission should be through github, you should "submit" a link to the github repository
  • The repository should be a single HTML page, a single JavaScript file and optional CSS file(s)
  • As always, HTML, JavaScript and CSS must be valid.
  • As always, JavaScript must not produce any errors.
  • Proof that I will be using (outside of reviewing the code) in the inches to cm form, Entering in 1 inch should produce a result of 2.54 centimeters. In the centimeter to inches form 1 centimeter should convert to 0.393701 inch
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.