Please enable JavaScript to use CodeHS

  • Autograded
  • Holiday

Holiday Wrapping Paper

In this project, students will use conditional and string commands to help calculate the wrapping paper needed to wrap holiday presents.

Easy

1 Hour

High School

Project Description

Background

The holidays are quickly approaching and you realize you may have made a mistake volunteering to wrap ALL the holiday presents at your local mall. With only a few days to spare, your boss sent you a list of the dimensions for all the remaining packages to wrap and asked you how much more wrapping paper to order.

The list is long. Really long.

Your Task

So you decided to write a program to calculate the exact amount of wrapping paper needed. The starter code will prompt you for a file name and then use that file name to read in each line.

Using the for loop, process each line and calculate the surface area for each package. You can assume each package is a rectangular prism.

Each line of input will either be three numbers separated by an x to represent length, width, and height, or it will be a single number. If it is a single number, then the box is a perfect cube and the single number represents the side length.

Once you calculate the total surface area print that value out and also print out how many rolls will be needed to complete the job. Each roll of wrapping paper can wrap 180 square feet.

Project Demo

Explore this program before assigning it!

Project Overview

Here is an outline of the project activities: