Site icon Tutor Bin

San Jose City College Lovelace Cupcakes Worksheet

San Jose City College Lovelace Cupcakes Worksheet

Description

I do it almost done, Just fix something.

Lovelace Cupcakes – Insertion Sort

“Cupcakes coded with love”

The first computer programmer in the world was a women, Ada Lovelace. (Links to an external site.)

What the assignment is about

Ms. Lovelace’s great great-great-grandchild is Lilly is an amazing computer scientist. Lilly Lovelace has decided to create a cupcake business to honor Ada. The cupcakes have sweet names mixed with technical terms. The business has 120 distinct designs of cupcakes with 2 types of frosting. Cupcakes range from Macaroon Sesame with Chocolate Frosting to Jelly Plum with Whipped Cream Frosting. Lovelace Cupcakes can serve an impressive 480 types of cupcakes to its customers and has over 800 franchises in more than 70 cities around the world.

The Lovelace business has grown into an empire worth billions of dollars and they now need to sort their menu and need the company needs your help.

They have hired you to complete this task.

Sincerely,

Lilly Lovelace, CEO Lovelace Cupcakes – “Cupcakes coded with love”.

What to do

Implement insertion sort (Links to an external site.) for Lilly Lovelace that prints all the cupcakes alphabetically list.

How to do it

Task 1

Review and study the Canvas modules on Arrays and Sorting as needed. Insertion Sort is a well-known sorting algorithm with O(n2) performance.

Task 2

  1. Create a new GitHub repository by using GitHub desktop
  2. Perform a GitHub commit and publish to publish your repository on GitHub.com

Task 3

  1. Create a Maven project in your GitHub repository folder.
  2. Run your new Maven application (App.java) and make sure it works (it should print “hello world”).
  3. If you can’t recall how to create a Maven project properly, please review the previous “Hello World with Maven” assignment which contains detailed instructions on Maven and example videos for students.
  4. Perform a GitHub commit and include a short concise commit message to help build up your Git history through development.
  5. Perform a GitHub push to save your work to GitHub.com
  6. Repeat the edit code, git commit, git push process until you have completed this task.

Task 4

1. Download the lovelace-cupcake-example-code.zip Download lovelace-cupcake-example-code.zipthat includes BubbleSort.java (or MergeSort.java) example code and put it into your project. This .zip file also includes the cupcake_3906.json data file.

2. Edit the code to get the sorting algorithm to run on your computer. Try to get BubbleSort.java to run on your computer in your Maven project.

To do this you’ll need to make sure you:

2a. Make sure you have have the example code .java and .json files in the correct directory on your computer. Please see the screenshot below for an example. Your directory names my be different depending on what you typed into Maven. But, your directory names should be similar.

2b. Make sure you add the Maven dependency to use Google’s JSON libraries (Links to an external site.) into your pom.xml file. See screenshots below.

      • Make sure your App.java hello world can run. Hello World should work.
      • To run BubbleSort.java (or MergeSort.java) , students will need to be sure to get the Java package information on the 1st line of BubbleSort.java (or MergeSort.java) and JSONFile.java to be correct (the same as it is in App.java).
      • Students will also need to make the path to the json file correct in the java files for their laptops so java can read the json files.

3. The example code is example code provided to give students a head start. Students do not have to use it. Students can certainly write their own solution from scratch if they wish to.

4. If students have trouble getting the example code to work, I highly recommend students come to office hours and/or talk with other students.

5. Edit your code by making small incremental changes.

6. For each small change, perform a GitHub commit and include a short concise commit message.

7. Perform a GitHub push to save your work to GitHub.com

8. Repeat the change/edit code, git commit, git push process until you have completed this task.

Task 5

  1. Read and watch videos on insertion sort to learn it’s fundamentals. There are hundreds of videos on the internet explaining insertion sort. Below is a high-quality and excellent video and demo on insertion sort that Harvard University produced.

Task 6

  1. Write insertion sort from scratch.
  2. Copy the insertion sort code from Geeks for Geeks written in Java (Links to an external site.) for insertion sort algorithm and get it to run.
  3. If you want to make the assignment more challenging, try to implement insertion sort without copying the example code from Geeks for Geeks. Use only the Harvard video explanation, and write the code on your own.
  4. If you want to make this assignment easier, simply use Geeks for Geeks code.Edit your code by making small incremental changes.
  5. For each small change, perform a GitHub commit and include a short concise commit message.
  6. Perform a GitHub push to save your work to GitHub.com
  7. Repeat the change/edit code, git commit, git push process until you have completed this task

Task 8

  1. Students need to use this example assignment .docx file when submitting this assignment to make submission simple, organized, and straight forward for students.
  2. If it is used, students simply need to delete my examples, put in your work, save the .docx file as a pdf, and submit the pdf
  3. Submit your assignment.

Tips

  • Your solution (insertion sort) should produce identical results to the bubble sort and merge sort example code given in this assignment. Students are replacing the sort routine with their implementation of insertion sort.
  • There are two “test” cupcake json files that can be used to test your solution. You can start testing your sort routine using the 5 and 10 cupcake json files. When you submit the assignment, be sure to test and get your insertion sort to work on the real 3906 cupcake json file.
  • Your solution should increase the count variable by 1 inside the inner-most for-loop of insertion sort. See the bubble sort example code.
  • In our examples, and your code you will sort lexically, which is technically slightly different than alphabetically. Sorting lexically is totally fine for our purposes.

Example Solution

Lovelace Cupcake assignment output using the 10 cupcakes test json file.

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Exit mobile version