Your company, A to Z Logistics, is in charge of packing shipping containers. Every container has two large compartments. The items being shipped go evenly into the two compartments. Each item is encoded as a single character, a-z (lowercase) or A-Z (uppercase). Your job is to write a program to calculate the shipping fees based on the items that go into the containers. Specification Your program will be provided, as input, one or more strings. Each container string contains only letters and it represents what's to be put into a container. A string that starts with a dot (it will be the only character in the string) will mark the end of input. Here is a sample input, consisting of four container strings and the input-terminating string: bmaBbZjRvs PBZRiwlHcmbMRMUSTaCF xpIJDqWoMnisOSFY KLUSgJFedAkFfScuVRYxekDgsc Because of limitations on container size, no string will be longer than 100 characters. Each letter corresponds to an item whose weight is determined by the table here: Letter a lb C ... Z A B Z Weight 0.1 kg 0.2 kg 0.3 kg 2.6 kg 2.7 kg 2.8 kg 5.2 kg In short, each successive letter represents an increase in weight of 0.1 kg, starting with 0.1 kg for "a" up to 5.2 kg for "Z". Since the items in each container are split among the two compartments, the first half of the string represents the items in the one compartment and the second half are the items in the other compartment. To calculate the billable weight, sum up the weights of the items in each compartment. Only the greater of the two weights will be used to calculate the shipping fee. The shipping fee is billed at $2.75 per kilogram. When input has ended (signified by the single dot on a line by itself), the program displays the total shipping fee, displayed as a dollar amount with two decimal places

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

Need help writing this in C language

 

 

 

Your company, A to Z Logistics, is in charge of packing shipping containers. Every container has two large compartments. The items being shipped go evenly into the two compartments. Each item is encoded as a single
character, a-z (lowercase) or A-Z (uppercase). Your job is to write a program to calculate the shipping fees based on the items that go into the containers.
Specification
Your program will be provided, as input, one or more strings. Each container string contains only letters and it represents what's to be put into a container. A string that starts with a dot (it will be the only character in
the string) will mark the end of input.
Here is a sample input, consisting of four container strings and the input-terminating string:
bmaBbZjRvs
PBZRiwlHcmbMRMUSTaCF
xpIJDqWoMniSOSFY
KLUSgJFedAkFfScuVRYxekDgsc
Because of limitations on container size, no string will be longer than 100 characters.
Each letter corresponds to an item whose weight is determined by the table here:
Letter
a
b
C
...
Z
A
B
Z
Weight
0.1 kg
0.2 kg
0.3 kg
2.6 kg
2.7 kg
2.8 kg
5.2 kg
In short, each successive letter represents an increase in weight of 0.1 kg, starting with 0.1 kg for "a" up to 5.2 kg for "Z".
Since the items in each container are split among the two compartments, the first half of the string represents the items in the one compartment and the second half are the items in the other compartment.
To calculate the billable weight, sum up the weights of the items in each compartment. Only the greater of the two weights will be used to calculate the shipping fee.
The shipping fee is billed at $2.75 per kilogram.
When input has ended (signified by the single dot on a line by itself), the program displays the total shipping fee, displayed as a dollar amount with two decimal places.
Transcribed Image Text:Your company, A to Z Logistics, is in charge of packing shipping containers. Every container has two large compartments. The items being shipped go evenly into the two compartments. Each item is encoded as a single character, a-z (lowercase) or A-Z (uppercase). Your job is to write a program to calculate the shipping fees based on the items that go into the containers. Specification Your program will be provided, as input, one or more strings. Each container string contains only letters and it represents what's to be put into a container. A string that starts with a dot (it will be the only character in the string) will mark the end of input. Here is a sample input, consisting of four container strings and the input-terminating string: bmaBbZjRvs PBZRiwlHcmbMRMUSTaCF xpIJDqWoMniSOSFY KLUSgJFedAkFfScuVRYxekDgsc Because of limitations on container size, no string will be longer than 100 characters. Each letter corresponds to an item whose weight is determined by the table here: Letter a b C ... Z A B Z Weight 0.1 kg 0.2 kg 0.3 kg 2.6 kg 2.7 kg 2.8 kg 5.2 kg In short, each successive letter represents an increase in weight of 0.1 kg, starting with 0.1 kg for "a" up to 5.2 kg for "Z". Since the items in each container are split among the two compartments, the first half of the string represents the items in the one compartment and the second half are the items in the other compartment. To calculate the billable weight, sum up the weights of the items in each compartment. Only the greater of the two weights will be used to calculate the shipping fee. The shipping fee is billed at $2.75 per kilogram. When input has ended (signified by the single dot on a line by itself), the program displays the total shipping fee, displayed as a dollar amount with two decimal places.
Examples
For the container with items bmaBbZjRvs, one compartment gets items bmaBb and the other gets zjRvs. The sum of the weights for items bmaBb is 4.6 kg; the sum of the weights for items zjRvs is 14.7 kg. The greater
of these two is 14.7 kg. The shipping fee is $2.75 for each kg., or $40.42.
For container PBZRiwlHcmbMRMUSTaCF, the two compartments are PBZRiwlHcm) and (bMRMUSTaCF), of which the second one is heavier. The shipping fee is $81.95.
For container xpIJDqWoMnisoSFY, the two compartments are xpIJDqwo and MnisosFY). The shipping fee is $75.90.
Finally, for container KLUSgJFedAkFfScuVRYxekDgsc, the shipping fee is $85.53.
The total shipping fee for all four containers is $283.80.
Input and Output
The input to the program is the strings for all the containers, one per line.
Input is terminated by a string that contains only a single dot.
The program should display, at minimum:
• The number of containers;
• The total shipping fee.
For debugging purposes, it may display other information such as the weight and fee for each individual container. But the very last values displayed must the the number of containers and total shipping fee. This will
make it easier for me to locate them.
Sample Run
Here is a sample of inputs and outputs. The user's input is shown in bold to make it stand out; your program will not need to do that.
Container: tRbCJqJdJbGwHzZChxFVfaSonJJOBqPHimJq
Container: mQLDqEHRk1
Container: WAWweUUdGKUpfb
Container: TKHDDZENECXMKCBzkPSULZPpduxzqpIeMSZMEPPwQW
Container: KqdeyNvS
Container: enDEotyNOGBFjzZogurtHC
Container:.
6 containers, total shipping fee $544.50
Transcribed Image Text:Examples For the container with items bmaBbZjRvs, one compartment gets items bmaBb and the other gets zjRvs. The sum of the weights for items bmaBb is 4.6 kg; the sum of the weights for items zjRvs is 14.7 kg. The greater of these two is 14.7 kg. The shipping fee is $2.75 for each kg., or $40.42. For container PBZRiwlHcmbMRMUSTaCF, the two compartments are PBZRiwlHcm) and (bMRMUSTaCF), of which the second one is heavier. The shipping fee is $81.95. For container xpIJDqWoMnisoSFY, the two compartments are xpIJDqwo and MnisosFY). The shipping fee is $75.90. Finally, for container KLUSgJFedAkFfScuVRYxekDgsc, the shipping fee is $85.53. The total shipping fee for all four containers is $283.80. Input and Output The input to the program is the strings for all the containers, one per line. Input is terminated by a string that contains only a single dot. The program should display, at minimum: • The number of containers; • The total shipping fee. For debugging purposes, it may display other information such as the weight and fee for each individual container. But the very last values displayed must the the number of containers and total shipping fee. This will make it easier for me to locate them. Sample Run Here is a sample of inputs and outputs. The user's input is shown in bold to make it stand out; your program will not need to do that. Container: tRbCJqJdJbGwHzZChxFVfaSonJJOBqPHimJq Container: mQLDqEHRk1 Container: WAWweUUdGKUpfb Container: TKHDDZENECXMKCBzkPSULZPpduxzqpIeMSZMEPPwQW Container: KqdeyNvS Container: enDEotyNOGBFjzZogurtHC Container:. 6 containers, total shipping fee $544.50
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education