Professional Documents
Culture Documents
Assignment 4
Assignment 4
IPO
Input Process Output
Weight and Miles Ask the user for weight ,and Shipping charge
than or equal to to 50
an additional charge of
the rate.
This study source was downloaded by 100000831727298 from CourseHero.com on 03-20-2022 17:05:12 GMT -05:00
https://www.coursehero.com/file/113917380/Assignment-4docx/
#6 40 pounds / 3500 miles $5.00 $45.00
CODE
#include <stdio.h>
#include <stdlib.h>
// Joao Victor Moura . I will calculate the shipping charges of each test
according to their weight and mileage //
main() {
double weight, shippingCharge, rate, segments;
int distance;
printf("Enter the weight: \n");
scanf_s("%lf", &weight);
printf("Enter the distance: \n");
scanf_s("%i", &distance);
return 0;
}
if (weight <= 10) {
printf("Rate is $3.00 \n");
rate = 3;
}
else {
printf("Rate is $5.00 \n");
rate = 5;
}
if (distance % 500 == 0) {
segments = distance / 500;
}
else {
segments = distance / 500 + 1;
}
This study source was downloaded by 100000831727298 from CourseHero.com on 03-20-2022 17:05:12 GMT -05:00
https://www.coursehero.com/file/113917380/Assignment-4docx/
shippingCharge = rate * segments;
system("pause");
Test #1
This study source was downloaded by 100000831727298 from CourseHero.com on 03-20-2022 17:05:12 GMT -05:00
https://www.coursehero.com/file/113917380/Assignment-4docx/
Test #2
Test#3
Test #4
This study source was downloaded by 100000831727298 from CourseHero.com on 03-20-2022 17:05:12 GMT -05:00
https://www.coursehero.com/file/113917380/Assignment-4docx/
Test #5
Test #6
This study source was downloaded by 100000831727298 from CourseHero.com on 03-20-2022 17:05:12 GMT -05:00
https://www.coursehero.com/file/113917380/Assignment-4docx/
This study source was downloaded by 100000831727298 from CourseHero.com on 03-20-2022 17:05:12 GMT -05:00
https://www.coursehero.com/file/113917380/Assignment-4docx/
Powered by TCPDF (www.tcpdf.org)