Question

In: Computer Science

Task #1 It is orientation day at the college. Students need to go to a specific...

Task #1 It is orientation day at the college. Students need to go to a specific room based on their status. Their status can be either international full-time, domestic full-time, or domestic parttime. Your task is to complete a program that will do the following: • Ask a student for their name • Ask them for their status – keep the status simple in order to ensure that you do not have to handle a wide variety of inputs. For example, you can ask them to enter I for international full-time, F for domestic full-time, and P for domestic part-time. • Display a message that lists their name and the room that they must go to. If the students are international full-time they are to be directed to room 227. If they are domestic full-time they must meet in room 123. If they are domestic part-time they must meet in room 055. Create the JavaScript program for task #1

Solutions

Expert Solution

Hello,

I have created javascript code based on your requirement. I have used alert to display student information finally. Please let me know if any changes required.

JavaScript code snippet:

// Prompt for Stundent name and assign user input to name variable
var name = prompt('Please enter your name');
// Prompt for Stundent status and assign user input to status variable
var status = prompt('Please enter your status. \n Enter I for international full-time \n Enter F for domestic full-time \n Enter P for domestic part-time');
// Declare roomNo variable
var roomNo;

// Assign roomNo based on student status by using if-else statements
if(status==='I') {
    roomNo = '227';
} else if(status==='F') {
    roomNo = '123';
} else if(status==='P') {
    roomNo = '055';
}

// Displaying message that lists out stundent name and room they need to go by using alert
alert("Student Name : " + name + "\nRoom Number to go : " + roomNo);

Output:

If you want to see the output message in console you can use below code snippet

// Prompt for Stundent name and assign user input to name variable
var name = prompt('Please enter your name');
// Prompt for Stundent status and assign user input to status variable
var status = prompt('Please enter your status. \n Enter I for international full-time \n Enter F for domestic full-time \n Enter P for domestic part-time');
// Declare roomNo variable
var roomNo;

// Assign roomNo based on student status by using if-else statements
if(status==='I') {
    roomNo = '227';
} else if(status==='F') {
    roomNo = '123';
} else if(status==='P') {
    roomNo = '055';
}

// Displaying message that lists out stundent name and room they need to go by using console log
console.log("Student Name : " + name + "\nRoom Number to go : " + roomNo);

Output would be in console as like below


Related Solutions

At one college, the proportion of students that needed to go into debt to buy their...
At one college, the proportion of students that needed to go into debt to buy their supplies each term (books, tech, etc.) was once known to be 74%. An SRS of 60 students was then surveyed in a later term, in order to see if this previous proportion would still be supported by the new sample evidence. Out of these 60 sampled students, 52 needed to go into debt to buy their supplies that term. Using a normal distribution of...
A survey of college students reported that they spend an average of $9.50 a day on...
A survey of college students reported that they spend an average of $9.50 a day on dinner with a standard deviation of $3. What is the probability that 100 randomly selected college students will spend less than $10.00 on average for dinner? Round your answer to 4 decimal places.
A dorm at a college houses 1900 students. One​ day, 20 of the students become ill...
A dorm at a college houses 1900 students. One​ day, 20 of the students become ill with the ​flu, which spreads quickly. Assume that the total number of students who have been infected after t days is given by: N(t)=1900/1+25e-0.65t ​a) After how many days is the flu spreading the​ fastest? ​b) Approximately how many students per day are catching the flu on the day found in part​ (a)? ​c) How many students have been infected on the day found...
About 58% of students go to a college within 100 miles of their home. If you...
About 58% of students go to a college within 100 miles of their home. If you choose a random sample of 10 students, what is the probability that at least four students go to a college within 100 miles of their home?
A group of college students want to have a party. They need to decide if they...
A group of college students want to have a party. They need to decide if they want to have it at the Beach (B) or at the Park (P) or in a Warehouse (W). They were ask to list in order their 1st, 2nd, and 3rd choice of where they want to have the party. Use the following table and answer the following questions. SHOW YOUR WORK to receive full credit. 10 students 8 students 13 students 1 st choice...
A study of 50 randomly selected students from a particular college who did not go to...
A study of 50 randomly selected students from a particular college who did not go to the campus Learning Center for statistics tutoring had a mean overall grade (at the end of the semester) of 68.41% with a standard deviation of 9.60%. The same study also found that 48 randomly selected students who did take advantage of the tutoring at the campus Learning Center had a mean overall grade of 79.25% with a standard deviation of 8.71%. The standard deviation...
A professor has two daughters that he hopes will one day go to college. Currently, in-state...
A professor has two daughters that he hopes will one day go to college. Currently, in-state students at the local University pay about $21,435.00 per year (all expenses included). Tuition will increase by 5.00% per year going forward. The professor's oldest daughter, Sam, will start college in 16 years, while his youngest daughter, Ellie, will begin in 18 years. The professor is saving for their college by putting money in a mutual fund that pays about 9.00% per year. Tuition...
A professor has two daughters that he hopes will one day go to college. Currently, in-state...
A professor has two daughters that he hopes will one day go to college. Currently, in-state students at the local University pay about $21,801.00 per year (all expenses included). Tuition will increase by 4.00% per year going forward. The professor's oldest daughter, Sam, will start college in 16 years, while his youngest daughter, Ellie, will begin in 18 years. The professor is saving for their college by putting money in a mutual fund that pays about 7.00% per year. Tuition...
A professor has two daughters that he hopes will one day go to college. Currently, in-state...
A professor has two daughters that he hopes will one day go to college. Currently, in-state students at the local University pay about $20,432.00 per year (all expenses included). Tuition will increase by 3.00% per year going forward. The professor's oldest daughter, Sam, will start college in 16 years, while his youngest daughter, Ellie, will begin in 18 years. The professor is saving for their college by putting money in a mutual fund that pays about 9.00% per year. Tuition...
A professor has two daughters that he hopes will one day go to college. Currently, in-state...
A professor has two daughters that he hopes will one day go to college. Currently, in-state students at the local University pay about $22,119.00 per year (all expenses included). Tuition will increase by 3.00% per year going forward. The professor's oldest daughter, Sam, will start college in 16 years, while his youngest daughter, Ellie, will begin in 18 years. The professor is saving for their college by putting money in a mutual fund that pays about 7.00% per year. Tuition...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT