ICT10013 Programming Concepts Assignment - Create a function

Assignment Help Other Subject
Reference no: EM132390180

ICT10013 Programming Concepts Assignment - Swinburne University of Technology, Australia

Assignment 1 -

This assignment contains a number of tasks for you to attempt. There are three types of task:

Tasks labelled as "no submission required, not part of portfolio"

  • They are for you to attempt and practice.
  • They provided assistance for you to develop solutions to other tasks that are part of your portfolio.

Tasks labelled as " BASIC Submission Task"

  • These tasks are part of your portfolio geared towards all students.
  • The solutions to these tasks must be uploaded for marking by your tutor.

Tasks labelled as "ADVANCED Submission Task"

  • These tasks are part of your portfolio geared mainly towards students aiming for more than a pass grade. Of course students aiming for a pass grade may attempt and submit these tasks.

JavaScript Tasks -

Task 1 - Create a HTML file named w7t1.html based on template_upd.html

  • Ensure the footer section contains your name.
  • Inside the header section: add a h1 element with the value "Week 7"
  • Inside the article section: add form tags.
  • Within the form tags add a paragraph with a label tag containing Customer Name:
  • Add an input element within the above label tag. The type attribute of the element must be text. The id of the element must be custname.
  • Add a button element. The type attribute of the element must have the value button. The id attribute of the element must have the value process. The text on the button must be Process Name
  • Add the following paragraph tag: <p id="output"></p>

Create a JavaScript file named w7t1.js based on template.js. Link this file to w7t1.html.

Within init():

  • Use document.getElementByID("...").onclick with the relevant button id to assign call to the function start()

Create a function called start().

This function must:

  • Create a local variable vName.
  • Get the input from the textbox with id custname and assign it to variable vName.
  • Display the value of the vName in the paragraph with id output.

Task 2 - Same as above, plus

When you click the button, the HTML id output should display:

  • Display the value of the vName
  • Display the length of vName

Task 3 - Create a function processString() that takes one parameter str.

This function extracts the first character from str using charAt(0) and returns the string "The first letter of the name is: X" where X will be replaced by the first character.

Within start():

Same as above, plus

  • When you click the button, the HTML id output should also display: The string showing the first letter of vName returned by processString()

Task 4 - Modify processString() so that it returns two first characters of the parameter str as shown on the screenshot.

Within start(): Same as above, plus

  • When you click the button, the HTML id output should also display: The second letter of vName.

Task 5 - Create a HTML file named w7t6.html based on template_upd.html

  • Ensure the footer section contains your name.
  • Inside the header section: add a h1 element with the value "Week 7"
  • Add a button element. The type attribute of the element must have the value button. The id attribute of the element must have the value process. The text on the button must be Process Array.
  • Add the following paragraph tag: <p id="output"></p>

Create a JavaScript file named w7t6.js based on template.js. Link it to the w7t6.html When a user clicks the button, call the function process().

Within process():

  • Create an array named arrNameList with the following names: John, Jenny
  • Call the function processArray() passing arrNameList as a parameter. This function does not return any values so you do not need assignment statement.

Create a function called processArray() which takes one parameter pArray. This function does not return any values. This function must:

  • Display the number of elements in pArray in the paragraph with id output as on the screenshot (use the relevant property of the array).

Task 6 - Same as above, except

  • When the user clicks the button, the paragraph with id output must display: All the names in the array (see the screenshot).

Task 7 - Create a HTML file named w7P.html based on template_upd.html

  • Make sure that the <footer> section and the meta tag with the name author contain your student name and ID.
  • Inside the <header> section add a h1 element with the value "Week 07 Pass Submission".
  • Inside the <article> section create a form containing a label showing Customer Name and a textbox with id custname.
  • Add a button element. The type attribute of the element must have the value button. The id attribute of the element must have the value add. The text on the button must be Add Name.
  • Add a button element. The type attribute of the element must have the value button. The id attribute of the element must have the value process. The text on the button must be Process Name
  • Add the following paragraph tag: <p id="output"></p>

Create the JavaScript file w7P.js based on template.js and link to the html file.

Create a global array arrNameList.

Create an addName() function.

  • This function adds the name entered into the custname input box to the end of arrNameList.

Call this function when the user clicks the button with the id add.

Create a function called displayArray().

  • This function must list all the names in the array, one per line preceded by position number (see the screenshot).

Call this function when the user clicks the button with the id process.

Test your code.

Place the Screen Captures of the web page in your browser into W07P.DOCX

Copy and Paste the JavaScript code from your code editor into W07P.DOCX

Copy and Paste the HTML code from your web page into W07P.DOCX

Task 8 - Create a copy of HTML file w7P.html and rename it w7C.html.

  • Make sure that the <footer> section and the meta tag with the name author contain your student name and ID.
  • Inside the <header> section change the h1 element to display "Week 07 Credit Submission 1"

Make a copy of the JavaScript file w7P.js and rename it as w7C.js

Part 1 - Modify addName() so that before adding a name to the array list it will do the following:

Call a function named findName() to see if the name already exists in the array.

  • Use the while loop to check if the name is in the array (note, if the name is found the loop should stop).
  • If the name already exists then return false, otherwise return true

If findName() returns false, do not add the name to the array, but display "Cannot add xxxx: Name already exists" where xxxx is the custname value

Note, using break instruction to exit the loop is a bad programming practice and is not acceptable in this unit.

Test your code with a name duplicate and non-duplicate names.

Part 2 - Modify w7C.html as per specs below:

Inside the form tags, after textbox accepting Customer name, add a label showing Year of Birth and a textbox with id yob.

Modify w7C.jc as per specs below:

  • Create another global array arrYOB.
  • Modify the addName() function that when it adds a name to arrNameList, it also adds the year from the second textbox to arrYOB. At this point we recommend that you test that the function works by using Console.log() or alert()
  • Modify displayArray() so that it displays year birth next to the corresponding name. Note: if you know how to create tables in HTML, you may want to use <table>, <td> and <tr> tags to format your our output. This is optional.

Assignment 2 -

This assignment contains a number of tasks for you to attempt. There are three types of task:

Tasks labelled as "no submission required, not part of portfolio"

  • They are for you to attempt and practice.
  • They provided assistance for you to develop solutions to other tasks that are part of your portfolio

Tasks labelled as "PASS Submission Task"

  • These tasks are part of your portfolio geared towards all students.
  • The solutions to these tasks must be uploaded for marking by your tutor.

Tasks labelled as "CREDIT Submission Task"

  • These tasks are part of your portfolio geared mainly towards students aiming for more than a pass grade. Of course, students aiming for a pass grade may attempt and submit these tasks.

Task 1 - Create a HTML file based on template_upd.html:

  • Update the <head> section with the title being Arrays and with the relevant meta data.
  • The file should display a heading "Task 1".
  • Link a JavaScript file to this HTML file.

Create a JavaScript file that:

Has a function named start() that does the following:

  • Creates an array named arrValues which has the following values: [1,2,3]
  • Displays the text "List of Array Values:" on the web page.
  • Displays all the values in the array named arrValues on the web page.

Task 2 - Create a HTML file based on template_upd.html:

  • Update the <head> section with the title being List Values and with the relevant meta data.
  • The file should display a heading "Task 2"
  • Link a JavaScript file to this HTML file.

Create a JavaScript file that:

Has a function named start() that does the following:

  • Creates an array named arrValues which has the following values: [5,2,0]
  • Displays the text "List of Array Values:" on the web page.
  • Calls a function named displayValues() and pass the array named arrValues as an argument.

Create the function named displayValues().

  • It must have a single parameter (that will accept an array of values).
  • The function must display each of the elements stored within the array on the web page.
  • The function must not return a value.

Task 3 - Create a HTML file based on template_upd.html:

  • Update the <head> section with the title being More on Arrays and with the relevant meta data.
  • The file should display a heading "Task 3"
  • Link a JavaScript file to this HTML file.

Create a JavaScript file that:

Has a function named start() that does the following:

  • Creates an array named arrValues which has the following values: [6,2,4]
  • Displays the text "List of Array Values:" on the web page.
  • Calls a function named updateValues() and pass the array named arrValues as an argument.
  • Calls a function named displayValues() and pass the array named arrValues as an argument.

Create the function named displayValues().

  • It must have a single parameter (that will accept an array of values).
  • The function must display each element stored within the array on the web page.
  • The function must not return a value.

Create the function name updateValues().

  • It must have a single parameter (that will accept an array of values).
  • The function must set each value in the array to zero.
  • The function must not return a value.

Task 4 - Create a HTML file based on template_upd.html:

  • Update the <head> section with the title being About Objects and with the relevant meta data.
  • The file should display a heading "Task 4"
  • It should also contain a paragraph with id "doglist"
  • Link a JavaScript file to this HTML file.

Create a JavaScript file, within which:

  • Create a function named start() called as a response to the onload event.
  • Place this code at the beginning of the start() function: var vDog; vDog = {dogBreed:"Poodle", colour:"Black", dogName:"Rollie"};
  • Write additional code within the start() function so that the contents of vDog are extracted and displayed onto the Web Page in the following format (attached).

Task 5 - Replace the start() function with this code:

function start() {

var vDog1 = {dogBreed:"Poodle", colour:"Black", dogName:"Rollie"};

var vDog2 = {dogBreed:"Terrier", colour:"White", dogName:"Rex"};

var vDog3 = {dogBreed:"Greyhound", colour:"Brown", dogName:"Wilks"};

var arrDogs = [vDog1, vDog2, vDog3];

var output = "List of Dogs<br />";

output = output + arrDogs[0].dogName + "<br />";

output = output + arrDogs[1].dogName + "<br />";

output = output + arrDogs[2].dogName + "<br />";

//Add a statement displaying output in the paragraph with id "doglist"

}

Task 6 - Modify the start() function.

Replace the 3 statements adding values to the variable output by

  • Writing a for Loop that processes all the elements of the array.
  • The code within the for block must contain a single statement output = output + ... + "<br />";

The output generated by your code must be identical to Task 5.

Task 7 - Modify the start() function.

Add two additional dog objects with appropriate breeds, colours and names.

Test your code again.

Your code should display all dog names.

You should not have to modify any code in the for Loop.

Task 8 - Modify the start() function so that it contains:

function start() {

var vDog1 = {dogBreed:"Poodle", colour:"Black", dogName:"Rollie"};

var vDog2 = {dogBreed:"Terrier", colour:"White", dogName:"Rex"};

var vDog3 = {dogBreed:"Greyhound", colour:"Brown", dogName:"Wilks"};

var arrDogs = [vDog1, vDog2, vDog3];

displayDogs(arrDogs);

}

Create a function displayDogs(arrDogList) { }

Write additional code in the displayDogs() function so that all dog names are displayed. Use a for Loop to achieve this. (Hint: you can just copy the relevant code from the start() function to the displayDogs() function.

Finally, modify the statement adding values to the variable output so that it displays dogName and dogBreed properties.

Task 9 - Create a HTML file based on template_upd.html:

  • Update the <head> section with the title being Pass Task 2 and with the relevant meta data.

Make sure your name and student ID are part of metadata.

  • The file should display a heading "Pass Task - Objects"
  • It needs some empty paragraphs with ids to be referred to from JavaScript to display outputs as listed in the following tasks.
  • Link a JavaScript file to this HTML file.

Create a JavaScript file that:

Has a function named start() containing the following lines of code:

var vStu1 = {id:"12345", name:"Dave Smith", finalMark:68};

var vStu2 = {id:"43531", name:"Emma Black", finalMark:97};

var vStu3 = {id:"97894", name:"Sue Lee", finalMark:74};

var arrStudents = [vStu1, vStu2, vStu3];

Add code to the start() function that:

  • Calls a function named listStudents() and passes the argument arrStudents to it
  • Calls a function named displayStats() and pass the argument arrStudents to it

Write the function named listStudents() which expects a single parameter.

  • The parameter is an array of student objects.
  • The function must display all student details on the web page in the following format:
  • ID: 99999 Name: XXXXXXXXXXXXXXX Subject Mark: 99

Write the function named displayStats() which takes a single parameter.

The parameter is an array of student objects.

The function must calculate and display:

  • The number of students in the array.
  • The total of all student test scores (use a loop to calculate that).
  • The average final mark (formatted to 2 decimal places): E.g. Total Students: 3, Total of all Test Scores: 41 and Average Test Score: 79.67.

Test and if necessary troubleshoot your code.

Paste your HTML code, JavaScript code and Screen Captures into the file named: W08P.docx

Task 10 - Create a HTML file based on template_upd.html:

Update the <head> section with the title being Credit Task and with the relevant meta data. Make sure your name and student ID are part of metadata.

The page should look similar to the screenshot, i.e. have 2 buttons and 3 textboxes with the following labels:

  • Customer Id,
  • Name
  • Points balance.

The HTML page must also have a paragraph with the id value "output".

Link a JavaScript file to this HTML file.

When the user clicks the Add Customer to List button, call the addCust() function in the JavaScript file.

When the user clicks the List All Customers button, call the listCust() function in the JavaScript file.

In the JavaScript file:

Create a global array named garrCust.

Create a function addCust(). This function must:

  • Gather the id, name and amount data from the web page
  • Create a customer object using that data
  • Add that object to the array named garrCust
  • Display the text in the output element of the web page "Customer Added. Total number of customers is 99" (where 99 is the current length of the garrCust array).

Create a function listCust(). This function must:

  • Clear the value of HTML"output" element.
  • Display every customer in the garrCust array in "output" using the format:
  • Customer Id:XXX Name:XXXXXXXXXXXX Points balance:9999
  • After all customer details have been displayed, call countBelowN() passing garrCust as an argument as well as some value for comparison and display the returned value in the format
  • "Total number of customers with points balance below 99999:" 99

Create a function countBelowN() that expects two parameters - an array and value to compare balance to. This function must:

  • Initialise the counter to 0;
  • Compare points balance for every customer in the garrCust array with the value (second parameter); if the balance is below the value, then increment the counter;
  • Return the counter.

Imagine that the List All Customers button was clicked before any customer was added to the array. In this case the user should get a message "No customers on this list".

Hint: within the function listCust() use an if statement to check if the length of the array is 0, in this case display the error message, otherwise execute the code listing customers and displaying the total amount.

Test your code by adding at least 6 different customers with differing balances. Screen capture the screen after the List All Customers has been clicked.

Attachment:- Programming Concepts Assignment Files.rar

Verified Expert

This task was preparing the programs on the specified scenario using the javascript language. The amount calculator was designed using the programming language. The screenshots of the running programs were provided in the word file.

Reference no: EM132390180

Questions Cloud

What is the role of the front- and back-end platform : What is the role of the front- and back-end platform? Which component can be seen by the client?
Review problem based on workers productivity : Efficiency wage theory argues that workers' productivity depends on their pay, and so employers will often find it worthwhile to pay their employees somewhat.
What factors are important to grasp about leadership : Do companies have to operate ethically to be financially successful? Based on our reading material this week, what factors are important to grasp.
Had you ever thought about the culture of your organization : Can you describe the culture of the organization you work for? Before this week, had you ever thought about the culture of your organization?
ICT10013 Programming Concepts Assignment - Create a function : ICT10013 Programming Concepts Assignment Help and Solution - Swinburne University of Technology, Australia - Create a function processString()
Humans are the weakest link in the armor of security : As a manager, you're going to be responsible for security planning. Humans are the weakest link in the armor of security.
United states has number of privacy laws : The United States has a number of privacy laws that affect the government's use of information as well as the use of information by specific industries
Physical barriers-how they coincide with physical security : What is physical security? What are physical barriers and how they coincide with physical security?
Integrity authentication and nonrepudiation for sensitive : Cryptography provides confidentiality, integrity authentication and nonrepudiation for sensitive information while it is stored, traveling across network

Reviews

Write a Review

Other Subject Questions & Answers

  Evaluate the current myers-briggs type indicator

Evaluate the current Myers-Briggs Type Indicator MBTI personality instrument, which is based on Jungs theories

  Similar between althea gibson and venus williams

What are the key elements that are similar between Althea Gibson and Venus Williams? Please compare and contrast these two African American athletes.

  Explain particular recommendations for policy makers

Using that research, develop and explain particular recommendations for policy makers. For instance, restrict texting, or regulate the use of hand-held phones. All your recommendations must be supported by your research findings.

  Will rate lifesaver

Complete therest of the MRP table. The part is always made in batches of 150,lead-time is 4 days, and the required safety stock is 15 units.Current inventory is 70 units, and there is a scheduled receipt for150 units on day 17

  What are the key features of the pull economy

This retailing revolution is characterized in the Frontline documentary on Walmart as the domination of the ‘pull economy' over the ‘push economy.'

  Discuss type of business organization to limit the liability

Using THREE of the seven factors as discussed in class (liability, taxation, financing, management, liquidity, formalities, and life of business).

  Behavioral intervention or drug-pharmacological intervention

The following website contains links to research projects on treatment for drug abuse currently being funded by the National Institute on Drug Abuse. Browse the various studies underway and choose a clinical trial that assesses a potential treatme..

  Identify the problem related to the donation of human organs

Identify the problem related to the sale, trade, or donation of human organs. Justify your solution; the reasons why your audience should accept your proposal?

  Population growth differ between rich and poor nations

What are the characteristics of r-selected species and k-selected species? Why is it difficult to determine a carrying capacity for humans? How does population growth differ between rich and poor nations?

  Identify the main challenges facing this group

Describe at least one specific example that illustrates such challenge(s) and how the group dealt with it.

  Promote children health by advocating for healthy school

As a parent, you might promote children's health by advocating for healthy school lunch, mandatory recess activity, or physical education classes.

  Define goals for each nursing diagnosis

A nurse at the local Senior Center made the following notation about a client: A 74-year-old female client wearing eyeglasses with bifocal lenses and hearing.

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