Java 代写 | Assignment 11 CS 1400

Java代写,使用BufferedReader读取用户输入流,判断字符串是否正确,然后根据输入的网站通过网络通信爬虫,获取网站的title等信息并通过控制台返回结果,2小时内完成。

Objective:  Gain a greater understanding manipulating strings.

 

Instructions:

You will create a program that gets just the title, ingredient  list, and directions  from allrecipes.com

 

Your Choice:

You can either create this program as a text-based program or as a GUI-based program.

If you choose to do this as a text-based program do the following:

  1. Print out your name.
  2. Ask for an “allrecipes.com” URL.
  3. If the URL does not contain “allrecipes.com” then print out an error message and exit.
  4. If the user failed to add “http://” then add it for him.
  5. Extract the title, ingredients, and directions  from the website.
  6. Please have every direction have two carriage returns from the last for better readability.

If you choose to do this as a GUI-based program do the following:

  1. Have a TextField for the user to put the “allrecipes.com” URL.
  2. Have a button that when pressed get the URL from the TextField.
  3. If the URL does not contain “allrecipes.com” then print out an error message in a TextArea.
  4. If the user failed to add “http://” then add it for him.
  5. Extract the title, ingredients, and directions  from the website and display them in the TextArea.
  6. Please have every direction have two carriage returns from the last for better readability.

 

Example  1:

Robert Ball (displayed  in the text-based version only)

Please enter the URL (displayed in the text-based version only. In the GUI version the user puts the information into a TextField)

http://cnn.com

I’m sorry, but that is not a valid allreciples.com URL. (This appears in the TextArea for the GUI version).

RUBRIC AND NEXT EXAMPLE ON NEXT PAGE.

 

Example  2:

Robert Ball (displayed  in the text-based version only)

Please enter the URL.       (displayed  in the text-based version only. In the GUI version the user puts the

information into a TextField)

http://allrecipes.com/recipe/apple-pie-by-grandma-ople/

(the following is displayed in the TextArea in the GUI version)

 

Title:

Apple Pie by Grandma Ople Recipe – Allrecipes.com

Ingredients:

1 recipe pastry for a 9 inch double crust pie

1/2 cup unsalted butter

3 tablespoons all-purpose flour

1/4 cup water

1/2 cup white sugar

1/2 cup packed brown sugar

8 Granny Smith apples – peeled, cored and sliced

Directions:

Preheat oven to 425 degrees F (220 degrees C). Melt the butter in a saucepan. Stir in flour to form a paste. Add water, white sugar and brown sugar, and bring to a boil. Reduce temperature and let simmer.

Place the bottom crust in your pan. Fill with apples, mounded slightly.  Cover with a lattice  work crust.

Gently pour the sugar and butter liquid  over the crust. Pour slowly so that it does not run off.

Bake 15 minutes  in the preheated oven. Reduce the temperature  to 350 degrees F (175 degrees C).

Continue  baking for 35 to 45 minutes,  until apples are soft.

 

Rubric:

  • URL checked. Error message printed out if incorrect and program exits.
  • Correct title.
  • Correct Ingredients.
  • Correct Directions.

MORE ON NEXT PAGE.