Create program that converts Centigrade to Fahrenheit

Assignment Help JAVA Programming
Reference no: EM132238036

Scripting for Design Assignment - Functions

OVERVIEW: Your task in this assignment is to create a JavaScript program that converts three Centigrade temperatures to three Fahrenheit temperatures.

The JavaScript code will work with four HTML elements:

  • 2 input elements for the input i.e. Centigrade temperature values.
  • 1 div element for the output i.e. Fahrenheit temperature values.
  • 1 button element to start the process.

Completion of the assignment will require coding two functions:

1. an onclick function that is connected to the button (as before).

2. a programmer defined function named convertToFahrenheit which will return a Fahrenheit temperature given the Centigrade value.

The code required for convertToFahrenheit is essentially the same as the convertToCentigrade function example provided in the TOPIC 4 notes, with the temperature scales reversed. The main change is the expression used to do the conversion. In the convertToFahrenheit function the expression to convert a Centigrade temperature to Fahrenheit is: 1.8 * degCentigrade + 32, where degCentigrade is the only parameter used by the function.

The input will consist of two Centigrade values, a base temperature and an increment. These two will determine the three Centigrade temperatures to convert. For example if a base temperature of 10 and an increment of 5 are entered then the code would convert 10oC, 15oC, and 20oC to their Fahrenheit equivalents i.e. it starts at 10 and bumps it up by 5, twice.

Therefore if the variables baseTemp and incrTemp are used to store the input values, the program would have to convert the three temperatures:

baseTemp

baseTemp + incrTemp

baseTemp + 2 * incrTemp

In summary, when the button is clicked the code that makes up the onclick function will:

1. input values from the text fields into variables

2. parse the input values

3. call the convertToFahrenheit function three times to convert the three Centigrade temperatures to Fahrenheit

4. round the Fahrenheit values to whole numbers

5. format and output the results to the div.

NOTE: Your objective is to code the JavaScript statements to produce the required structure, content, and especially the behavior.

Attachment:- Assignment File.rar

Reference no: EM132238036

Questions Cloud

Why would an organization divide a project into phases : When considering the selection of projects to be initiated, project portfolio management considers all of the following except for which one?
What are the ramifications of government contribution : What are the ramifications of government contribution and control of the Internet that nobody possesses?
Which supplier to choose to provide wiring and casing : What are some things that they might look at to determine which supplier(s) to choose to provide the wiring and the casing?
Develop mind-map for mcdonald to solve problem : cDonald’s across the globe and in the UK highlighted a consistent decline in sales. Develop a mind-map for McDonald to solve the problem.
Create program that converts Centigrade to Fahrenheit : CWMD2601 - Scripting for Design Assignment - Functions, DURHAM COLLEGE, Canada. create a JavaScript program that converts Centigrade to Fahrenheit temperatures
Describe the performance management cycle in public sector : Describe the performance management cycle in public sector?
Taking more proactive approach to retention outreach : These myths prevent organizations from taking a more proactive approach to retention outreach or becoming involved with retention outreach teams.
Weaknesses of business before taking strategic decisions : Why do you think it is important to analyse the existing strengths and weaknesses of a business before taking strategic decisions?
Why operations management is vital to his-her organization : Provide insights into your subject's role and why Operations Management is vital to his/her organization.

Reviews

len2238036

2/20/2019 1:12:34 AM

In this assignment is to create a JavaScript program that converts three Centigrade temperatures to three Fahrenheit temperatures. ASSIGNED - At date and time shown in DC Connect. DUE - At date and time shown in DC Connect. There is a 25% penalty for late assignments. Refer to the course outline for details. DEADLINE - Seven (7) days after due date and time shown in DC Connect unless noted otherwise. No assignments accepted after the deadline.

len2238036

2/20/2019 1:12:28 AM

MARKING - Marked out of 100 (80 for function, 10 for style, and 10 for documentation). Full marks given only if your solution: meets all of the requirements, has no runtime errors , follows all of the course coding conventions, uses only the JavaScript and DOM capabilities covered to this point in the course i.e. no JS libraries, uses external JavaScript and is submitted as a single zipped folder with all required files. SUBMITTING - Upload your work using the correct drop box in DC Connect. Only work submitted through DC Connect will be marked. Upload all required files (i.e. .html, .css, .js) as one compressed archive i.e. a zipped folder.

len2238036

2/20/2019 1:12:22 AM

The marking breakdown for this assignment is as follows: JavaScript code is connected to the button using the onclick property and the getElementById method, all required variables declared, input text fields are cleared and their values parsed, custom function convertToFahrenheit coded as required with one parameter and a return giving the correct converted value, custom function convertToFahrenheit called three times with the correct arguments and the returns value used, return values are rounded i.e. not rounded in the function, the output displayed includes all required values is properly formatted using p, ul, and li (including the symbol).

len2238036

2/20/2019 1:12:15 AM

REMEMBER, TO AVOID LOSING MARKS UNNECESSARILY - Only use JavaScript and DOM capabilities that have been covered to this point in the course to complete the assignment. Do not use any JavaScript libraries or frameworks such as jQuery. Always test your program with a variety of input values to ensure that it is working correctly i.e. has no syntax errors and produces the expected results. Add opening comments to identify yourself as the programmer and explain the purpose of your program. Add comments to document your code. View your source in Firefox before submitting to make sure that the indentation and white space are correct, and that horizontal scrolling is not required. Load all JavaScript code from one external file and submit all of the files used in the solution as one zipped folder. As the very last thing you do before submitting, test your program one more time and check the Console to ensure it is error free.

len2238036

2/20/2019 1:12:05 AM

NOTE: In general, the CSS or presentation of your solution (colors, fonts, margins, etc.) is at your discretion and does not usually contribute to your mark in the assignment. Your objective is to code the JavaScript statements to produce the required structure, content, and especially the behavior.

Write a Review

JAVA Programming Questions & Answers

  Design a set of classes for a graph data structure

Design a set of classes for a graph data structure that meets - Delete an edge from the graph - Retrieve the item associated with a given vertex.

  Determine a character type without using the char methods

Determine a character type WITHOUT using the char methods - how to use if -else statements for this project.

  Java class to accept a user-s hourly rate of pay

Write a class that accepts a user's hourly rate of pay and the number of hours worked. Display the user's gross pay, the withholding tax (15% of gross pay), and the net pay (gross pay - withholding).

  Program that reads a number in inches converts it to meter

CMP 330 Data Structures & Algorithm Analysis - Write a Java program to convert temperature from Fahrenheit to Celsius degree

  Given an aerodynamic body you have learned in aerodynamics

given an aerodynamic body you have learned in aerodynamics and flight mechanics how to apply the numerical source panel

  How to access to elements of document object model

To limit creation of malicious code, do you believe that access to elements of document object model and some Javascript functionality be limited?

  Write the method in java

2.char mostOftenIn(String s) that for a given string s, returns the character that occurs most often in s.

  Which announces whether or not the player has won the game

2D graphics, instead of text, to display the Xs and Os in the grids of the square- shaped buttons decision logic or recursion in order to determine whether or not a player wins the games. Display a message which announces whether or not the player ha..

  Describe how a semaphore can be used to act like a lock.

The loop should execute until a "shutdown" flag is set to true on the runnable object executing in the thread.

  Your task in this assignment is to develop a graphical user

your task in this assignment is to develop a graphical user interface based java program that can communicate with a

  Write a program that collects three strings

Write a program that collects three Strings from the user. Display the three strings in alphabetical order regardless of the order in which they were input.

  Develop a program that will handle a golfer and his scores

develop a program that will handle a Golfer and his scores. The program will be comprised of two classes: a Golfer class that will manage all the golfer's scores and a Score class.This is a class designed to represent a golfer including his name, hom..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd