Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this assignment, you will be adding, to your resume website ( 1 ) through looping, the top job duties that you preformed at your

For this assignment, you will be adding, to your resume website (1) through looping, the top job duties
that you preformed at your previous employment where the user specifies the number of job duties to
display. Then you will (2) use an if..else if...else statement to let the user know the salary you are
expecting. Place all JavaScript in a single external JavaScript file.
1. On the work experience page, we will add a user input that asks the user to enter the number of
job duties that they want to see that you preformed at your previous job. When the user clicks a
button, a function will be called and will then take this input and use it to specify an index
number of an array that will be the starting point of the array values (duties) to be displayed.
Through looping, we will then subtract 1 from the index number until it reaches 0 and display all
of the values that are associated with the index numbers that were calculated during the loop.
We will be making two of these functions (one for each job), but will be copying a great deal of
the code from one over to the other.
a. Create an input that acts as a fill in the blank for a sentence that prompts the user to
enter the number of job duties they want to see.
b. Create a button that calls a function when clicked (the function created in the next step)
c. Crate a function that takes the user input and assigns the value to a variable.
i. Explanation of why we did step 1 c: This variable represents the number of job
duties the user wants listed
d. Create an array with at least five job duties in it.
i. Explanation of step 1 d: Remember that the index starts at 0 and not 1.
ii. In the next steps we print out the array values by referencing their associated
index numbers, starting at the highest index number that we want printed and
counting down. The highest index number that we want printed is the number
that the user wants to be displayed minus 1.
1. Explanation of why we did step 1 d ii: If we did not obtain the highest
index number that we want to print by subtracting 1 from the number
that the user wants to be displayed and instead just used the user input
as the highest index number we would actually print out the number
the user wants to be displayed plus an extra. For example, if the user
INF 201 Assignment 4
asks for 3, we would count down index values: 3,2,1,0. Since that is
actually 4 values we will need to adjust for this in the next step by
removing the first value before the loop starts.
e. Create a new variable and set it equal to the inputted value minus 1
i. Explanation of why we did step 1 e: This variable is essentially representing the
first index number that we will call to be printed out, as discussed above.
f. Create a while loop that runs while the variable (that represents the index value that we
want to print) is greater than or equal to the minimum array value.
g. Within the while loop have two things happen.
i. Have the innerHTML of some element within your page be replaced with the
array value that corresponds to the index number that we want printed
1. You specify the array value by the format arrayname[indexnumber]
ii. Have the index subtract one from itself to count down
h. At this point your function should run, but it does not work properly. Only the array
value at the last index is printed. To fix this, we need to concatenate the results of the
loop.
i. Create a new variable outside of the loop and set it to be equal to blank
1. You do this by setting it equal to
ii. Within the loop, make this variable to be equal to itself plus the array value that
we want printed.
iii. Now change the innerHTML to be equal to this variable.
Question: What happens if we do not set this variable equal to blank first?
i. Copy this function over and change the name of the function, the id of the output and
input, and the array values to make it work for your second job.
2. On the form page, we will expand on the function that takes in user input for the last
assignment (asking what the salary and hours are) to let the user know if the salary is too little
or else if it is almost enough, else it is a good salary . We will say, for this assignment, that if the
salary is less than 20000 it is not enough, else if the salary is between 20000 and 25000 it is
almost enough, and (else) if the salary is greater than 25000 the salary is enough. This JavaScript
should all be done within the same function as the previous assignment.

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

Students also viewed these Databases questions