Question

this time capture at least three numbers (a year, a month, and a date as a...

this time capture at least three numbers (a year, a month, and a date as a minimum) to make a date. You should prompt the user for a year and then a month and then a day. Use this data to create a date object. Make sure not to use the default debugging output of the date in the story. Use a date method such as toDateString to create a nice output.

Make an object and use it to store at least three nouns (names of people, places, or things) used in your story. This doesn't have to be data that you asked the user for in prompts but it could be if you wanted it to be.

The other requirements are mostly the same as last week:

  • You must ask for a minimum of six (6) pieces of information (three of these will be numbers used to create your date object.
  • You must create and use at least one date type in your program based on user input. When you output this date, you must use a date method such as toDateString.
  • You must create at least one object that has three properties. This object does not need to come from user data but it can.
  • The story must be printed out to the console.
  • The output in the console should use the object and date variables you have created.
  • Keep it safe for work. I'm going to have you post your work to the discussion forum and you'll have to play the games your classmates create so keep it professional or you won't get a passing grade.
  • Submit both an HTML and JS file. I will start the program by opening the HTML file.
  • For extra credit you can create an array and use array methods to modify it. You must output the individual pieces of data from the array within

Homework Answers

Answer #1

Code :

<!DOCTYPE html>
<html>
<head>
   <title>Story</title>
</head>
<body>

   <script type="text/javascript">

       var day = prompt("Enter a day (1-30) : ");     // promt is used for getting the data feom the user
       var month = prompt("Enter a Month (1-12) : ");
       var year = prompt("Enter a Year : ");

       var date = new Date(year,month-1,day);            // since js counts month from 0-11
       var date_string = date.toDateString();

       var name1 = prompt("Enter a Name : ");
       var place1 = prompt("Enter a Place : ");
       var things1 = prompt("Enter a Things : ");

       var noun = {                                     // putting all the values into the noun object
           name : name1,
           palce : place1,
           things : things1
       };

       // story made and printed in the console
       console.log(noun.name + " went to " +noun.palce+ " at " +date_string+ " to get " +noun.things);

   </script>

</body>
</html>

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
*********JUST NEED JAVASCRIPT CODE************** I want you to create a Mad Libs game using the information...
*********JUST NEED JAVASCRIPT CODE************** I want you to create a Mad Libs game using the information from the lesson. There are a few requirements. The story must be printed out to the console. You must ask for a minimum of six (6) pieces of information. You must request at least three numbers add a number greater than one to each of them. What you decide to add is up to you but each value must be ADDED (not subtracted) to...
C++ Visual Studio 2019 Write a C++ console application that accepts up to 5 numbers from...
C++ Visual Studio 2019 Write a C++ console application that accepts up to 5 numbers from the user. Display all numbers, the highest, the lowest, and the average of the numbers. Ask the user if they want to continue entering another set of numbers. 1) Use proper naming conventions for your variables and functions. 2) Tell the user what the program is all about. Do NOT start the program with “Enter a number”!! 3) Create an array to store the...
Modify the Date class in Fig. 8.7 by adding a new method called nextDay() that increments...
Modify the Date class in Fig. 8.7 by adding a new method called nextDay() that increments the Date by 1 when called and returns a new Date object. This method should properly increment the Date across Month boundary (i.e from the last day of the month to the first day of the next month). Write a program called DateTest that asks the user to enter 3 numbers (one at a time) corresponding to Month, Day and Year. The first two...
C++ Programming   You are to develop a program to read Baseball player statistics from an input...
C++ Programming   You are to develop a program to read Baseball player statistics from an input file. Each player should bestored in a Player object. Therefore, you need to define the Player class. Each player will have a firstname, last name, a position (strings) and a batting average (floating point number). Your class needs to provide all the methods needed to read, write, initialize the object. Your data needs to be stored in an array of player objects. The maximum...
You have one Question, Which have four parts, 1st... PHP scriptIn a HTML document, use PHP...
You have one Question, Which have four parts, 1st... PHP scriptIn a HTML document, use PHP to obtain the following :The user will write a sentence as a value of a predefined variable.The output should look like this :The sentence you entered is :This is my sentenceIt is composed of :• 4 different words• 19 characters (including spaces)Note : Your program should make sure the final output is in lower case with the first letter in upper case. 2nd... PHP...
Use visual studio code to write the javascript programme. For this lab you must use a...
Use visual studio code to write the javascript programme. For this lab you must use a reasonable faceted search example, each item must have at least three categorical attributes and at least one numeric attribute. Attributes such as ID, name etc do not count as categorical or numeric attributes. (a) Define a class for your item that meets the above three categorical and one numeric attribute requirements. (b) Create a text file that contains at least 5 such records in...
Questions: 1. (5 marks) Create a VB.NET Console Application that defines a function Smallest and calls...
Questions: 1. Create a VB.NET Console Application that defines a function Smallest and calls this function from the main program. The function Smallest takes three parameters, all of the Integer data type, and returns the value of the smallest among the three parameters. The main program should (1) Prompt a message (using Console.WriteLine) to ask the user to input three integers. (2) Call the built-in function Console.ReadLine() three times to get the user’s input. (3) Convert the user’s input from...
Use visual studio code to write the javascript programme. For this lab you must use a...
Use visual studio code to write the javascript programme. For this lab you must use a reasonable faceted search example, each item must have at least three categorical attributes and at least one numeric attribute. Attributes such as ID, name etc do not count as categorical or numeric attributes. (a) Define a class for your item that meets the above three categorical and one numeric attribute requirements. (b) Create a text file that contains at least 5 such records in...
Using Python, students will use variables, input, and printing to create a Mad Lib. The program...
Using Python, students will use variables, input, and printing to create a Mad Lib. The program will print out the title of the Mad Libs story, as well as a short explanation of game play: The program should then prompt the user to enter in nouns, verbs, adjectives, proper nouns, and adverbs: Enter a proper noun: Enter a place: Enter another place: Enter an adverb: Enter a noun: Enter an adjective: Enter an adverb: Enter a verb: Enter a place:...
CIST 2371 Introduction to Java Unit 03 Lab Due Date: ________ Part 1 – Using methods...
CIST 2371 Introduction to Java Unit 03 Lab Due Date: ________ Part 1 – Using methods Create a folder called Unit03 and put all your source files in this folder. Write a program named Unit03Prog1.java. This program will contain a main() method and a method called printChars() that has the following header: public static void printChars(char c1, char c2) The printChars() method will print out on the console all the characters between c1 and c2 inclusive. It will print 10...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT