1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Wittaler [7]
3 years ago
8

Write a program that calculates the shipping charges for parcel. The program should ask the user to enter two floating point val

ues:
The weight of a parcel in pounds
The shipping rate per pound
The program calculates and displays the total shipping charges based on the parcel’s weight and shipping rate per pound.
Your program should print dollars and cents with two decimal places such as 32.85, and not 32.8467777.
Hint: Until we learn how to format output, we will use this little trick. You can round a floating-point value to the nearest hundredth by adding 0.005, multiplying by 100, converting the result to an integer, and then dividing by 100. This trick is not perfect but works well with most values.
Here is a sample of what a typical run of this program looks like where the user entered the values 4.75 for the weight and 2.55 for the shipping rate per pound:
Shipping Charges Calculator
Enter the weight of your parcel in pounds: 4.75
Enter the shipping price per pound: 2.55
The weight of your parcel is 4.75 pounds
The shipping price per pound is $ 2.55
The shipping charges for your parcel is $ 12.11
NOTE: Please remember that your program will be graded in terms of:
correctness: it performs the calculations correctly and uses proper arithmetic expressions: 75% (graded by Zybooks)
code style: good variable names, comments, proper indentation and spacing: 25% (grade by the TAs)
This program code is Python
Computers and Technology
1 answer:
Leona [35]3 years ago
6 0

Answer:

Answered below

Explanation:

#Program is written in Python programming language

#Get the weight and price and store them in #variables.

parcel_weight = float(input('Enter weight of parcel in pounds: "))

rate_per_pound = float(input ('Enter shipping price per pound: "))

# Calculate the total price per pound

total_price = parcel_weight * rate_per_pound

#print invoice

print ("Your parcel weighs $parcel_weight pounds')

print ("The rate per pound is $rate_per_pound")

print("Total shipping cost is; ")

print ("%.2f" % total_price)

You might be interested in
Find H.C.F of 4,5,10 by all the three methods.​
Deffense [45]

Answer:

1. Factorization Method

2. Prime Factorization Method

3. Division Method

7 0
3 years ago
What is the limitation of computer<br>​
eimsori [14]

The limitation of computer are:

  1. No self-intelligence
  2. No feeling
  3. No learning power
  4. Dependency

3 0
3 years ago
A network on the internet has a subnet mask of 255.255.240.0. what is the maximum number of hosts it can handle
Lera25 [3.4K]
It is a class B network, so for a class B network, the upper 16 bits form the network address and the lower 16 bits are subnet and host fields. Of the lower 16 bits, most significant 4 bits are 1111. This leaves 12 bits for the host number. So, 4096(2^12) host address exists. First and last address are special so the maximum number of address is 4096-2=4094.
7 0
4 years ago
Role based access control
Phantasy [73]

Answer:

Is better in situation in which we want to assign the rights not to the people, but to the specific job

Explanation:

<u>Definition</u>

In an organization  to assigned the role in the network access based with in organization we RBAC.

Its model consists of

  1. users
  2. roles
  3. permissions
  4. sessions

Therefore, we can say that, <em>RBAC is better in situation in which we want to assign the rights not to the people, but to the specific job</em>

8 0
4 years ago
Write and test a function that takes the addresses of three double variables as arguments and that moves the value of the smalle
damaskus [11]

Answer:

#include <bits/stdc++.h>

using namespace std;

// function to swap largest to third, smallest to first and middle to second

void valueSwap(double *a,double *b,double *c)

{

   // variables

  double f,s,t;

 // if value of first is greater than second

  if(*a>=*b)

  {

      // if value of first is greater than third

      if(*a>=*c)

      {

          // swap

          t = *a;

          if(*c>=*b)

          {

              s = *c;

              f = *b;

          }

          else

          {

              //swap

              f = *c;

              s = *b;

          }

      }

      else

      {

          //after all the swap

          f = *b;

          s = *a;

          t = *c;

      }

  }

  else

  {

      // if value of second is greater than third

      if(*b>=*c)

      {

          t = *b;

          if(*c>=*a)

          {

              // swap

              s = *c;

              f = *a;

          }

          else

          {

              //swap

              f = *c;

              s = *a;

          }

      }

      else

      {

          // after all the swap

          t = *c;

          s = *b;

          f = *a;

      }

  }

 

 // final values

  *a = f;

  *b = s;

  *c = t;

 

}

// main function

int main()

{

  // variables

  double n1,n2,n3;

  // ask to enter first number

  cout<<"Enter the first number:";

  // read first number

  cin>>n1;

  // ask to enter second number

  cout<<"Enter the second number:";

  // read second number

  cin>>n2;

  // ask to enter third number

  cout<<"Enter the third number:";

  // read third number

  cin>>n3;

  // call the function to swap values with address parameter

  valueSwap(&n1,&n2,&n3);

  // print number after swapping

  cout<<"Number after swapping: "<<n1<<" "<<n2<<" "<<n3<<endl;

  return 0;

}

Explanation:

Ask user to enter 3 double numbers.Then read 3 numbers from user and assign them  to variables "n1","n2" and "n3" respectively.Call the function valueSwap() which take address of all three variables as argument and then assign the largest value among the three to variable "n3" and smallest to "n1" and middle to variable "n2". Print the values after swapping.

Output:

Enter the first number:20                                                                                                  

Enter the second number:30                                                                                                

Enter the third number:10                                                                                                  

Number after swapping: 10 20 30

7 0
4 years ago
Other questions:
  • Exercise 3: Function Write a function named word_count that accepts a string as its parameter and returns the number of words in
    10·1 answer
  • Which structure is sometimes called the "gateway to memory"?
    14·1 answer
  • The first thing you must consider in any type of communication is ______.
    9·2 answers
  • Which of the following is not one of the Generally Accepted Recordkeeping Principles ("The Principles®")? a. Accountability b. S
    11·1 answer
  • Front and rear camber and toe settings are being adjusted during a four-wheel alignment. The correct order for performing these
    13·1 answer
  • Fill in the blanks
    7·1 answer
  • Write a function that will sum all of the numbers in a list, ignoring the non-numbers. The function should takes one parameter:
    8·1 answer
  • 2y/3 - y-1/6 + 7y-1/4 = 2 1/6​
    5·1 answer
  • Given that the input A is false, the input B is false, and the input C is true, what is the resulting value of the output?
    12·1 answer
  • Which new development in malware caused sandbox technology to automate and introduce artificial intelligence learning
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!