answer.
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
anygoal [31]
1 year ago
6

A large Internet merchandise provider determines its shipping charges based on the number of items purchased. As the number incr

eases, the shipping charges proportionally decrease. This is done to encourage more purchases. If a single item is purchased the shipping charge is $2.99. When customers purchase between 2 and 5 items, they are charged the initial $2.99 for the first item and then $1.99 per item for the remaining items. For customers who purchase more than 5 items but less than 15, they are charged the initial $2.99 for the first item, $1.99 per item for items 2 through 5, and $1.49 per item for the remaining items. If they purchase 15 or more items, they are charged the initial $2.99 for the first item, $1.99 per item for items 2 through 5, and $1.49 per item for items 6 through 14 and then just $0.99 per item for the remaining items. Allow the user to enter the number of items purchased. Display the shipping charges.
Computers and Technology
1 answer:
blsea [12.9K]1 year ago
7 0

Answer:

A C# programming language (console application) was used in this given question. below in the explanation section is the code used in executing the task that was carried out.

Explanation:

Solution

C# Programming language code (Console Application):

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;  

namespace ShippingProgram  

{

class Program  

{

public static double ShippingCharge(int items)  

{  

if(items==1)  

{  

return 2.99;  

}  

else if ((items>=2)&&(items<=5))  

{

return (2.99) + ((items - 1) * 1.99);  

}  

else if((items>5)&&(items<15))  

{  

return (2.99) + (4* 1.99)+((items-5)*1.49);  

}  

else  

{  

return (2.99) + (4 * 1.99) + ((10) * 1.49)+((items-14)*0.99);

}

}  

 static void Main(string[] args)  

{  

System.Console.Write("Enter the no of items: ");

int n = Convert.ToInt16(System.Console.ReadLine());

System.Console.WriteLine("Your shipping charges are: $"+ ShippingCharge(n));  

System.Console.ReadLine();  

}  

}  

}

You might be interested in
The height of a small rocket y can be calculated as a function of time after blastoff with the following piecewise function: y 5
SOVA2 [1]

Answer:

High level Language

understand

Explanation:

rocket is 0...4433456u888

5 0
1 year ago
What is retrieved from a search containing two terms separated<br> by the AND operator?
egoroff_w [7]

Answer:

A AND B= 1 or 0

1 1  1

0 1  0

1 0  0

0 0 0

So, as explained above if both are 1 we then only get 1, or else we get 0 always in case of AND which is a logical operator, whose output can be 0 or 1 only. This is being depicted above.

Explanation:

If both are 1 we get 1 or always else, we get the output =0.

8 0
2 years ago
Which of the following code is correct? I: print("Programming is fun") print("Python") print("Computer Science") II: print("Prog
vfiekz [6]

Answer:

None of the options is correct.

Explanation:

One of the simplest statements that you can write in Python is a print statement, which causes a message to be displayed on the screen. For example, the following statement causes the message Python programming is fun! to be displayed:

print 'Python programming is fun!'

Notice that after the word print, the Python programming is fun! was written inside a set of single-quote marks. The quote marks are necessary, but they will not be displayed. They simply mark the beginning and the end of the text that we wish to display.

Here is an example of how you would type this print statement at the interpreter’s

prompt:

>>> print 'Python programming is fun!'

After typing the statement you press the Enter key and the Python interpreter executes the statement, as shown here:

>>> print 'Python programming is fun!'

Python programming is fun!

>>>

Thus, the correct way to write the codes in the question is:

print 'Programming is fun'

print 'Python'

print 'Computer Science'

3 0
2 years ago
Write a loop that subtracts 1 from each element in lowerScores. If the element was already 0 or negative, assign 0 to the elemen
Xelga [282]

Answer:

The JAVA program to implement for loop for given scenario is shown below.

public class MyProgram {

   public static void main(String args[]) {    

     int len = 5;

     int[] lowerScores = new int[len];      

     lowerScores[0] = 5;

     lowerScores[1] = 0;

     lowerScores[2] = 2;

     lowerScores[3] = -3;      

     System.out.println("The original elements of array are ");

     for(int i=0; i<len; i++)

     {

         System.out.print(lowerScores[i]+" ");

     }      

     System.out.println();

     System.out.println("The modified elements of array are ");

     for(int i=0; i<len; i++)

     {

         // if element is 0 or negative, 0 is assigned to this index

         if(lowerScores[i] <= 0)

           lowerScores[i] = 0;

       // 1 is subtracted from every non zero and positive element

         else

           lowerScores[i] = lowerScores[i] - 1;

           

       System.out.print(lowerScores[i]+" ");

     }

   }

}

OUTPUT

The original elements of array are  

5 0 2 -3 0  

The modified elements of array are  

4 0 1 0 0

Explanation:

The integer array is declared as shown.

int[] lowerScores = new int[len];

The length of the array is given by integer variable len. As per the question, we have taken four elements and size of 5 for the given array.

int len = 5;

The elements of the array are initialized inside the program with the elements given in the question.

lowerScores[0] = 5;

      lowerScores[1] = 0;

The values of the array can be changed to test the program. Also, the size of the array can be changed for testing.

As per the given scenario, if the element is greater than zero, 1 is subtracted from this element. For elements less than or equal to zero, that particular element is assigned the value of 0.

The given program implements if else statement inside for loop for this purpose.

for(int i=0; i<len; i++)

     {

         // if element is 0 or negative, 0 is assigned to this index

         if(lowerScores[i] <= 0)

           lowerScores[i] = 0;

       // 1 is subtracted from every non zero and positive element

         else

           lowerScores[i] = lowerScores[i] - 1;

     }  

5 0
1 year ago
Read 2 more answers
Which statement below correctly differentiates between frames and bits? Frames have more information in them than bits. Frames a
9966 [12]
<span>Frames have more information in them than bits.
</span>
<span>Frames are made up of bits but not vice versa.


A bit (BInary digiT) is the basic unit of digital. It can be 0 (logical false, off) or 1 (not logical false - true, on). Four bits are in a nybble, which can have a value of 0 - 15, eight bits are in a byte which can have a value of 0 - 255. Words vary in size, they consist of multiple bytes and are generally correlated with the system's data bus/processor data width (a 64 bit system has an 8 byte word).
</span>
5 0
2 years ago
Read 2 more answers
Other questions:
  • Each of these is a basic type of a touch screen, except ________.
    10·2 answers
  • Write a copy constructor for carcounter that assigns origcarcounter.carcount to the constructed object's carcount. sample output
    15·2 answers
  • vertical exchanges are typically used only to buy and sell materials required for an organization's support activities ( True or
    14·2 answers
  • Given: an int variable k, an int array current Members that has been declared and initialized, an int variable memberID that has
    11·1 answer
  • You are attempting to open a file containing a list of integer numbers, each on a separate line, and read them into Python as in
    6·1 answer
  • Initialize a list. ACTIVITY Initialize the list short.names with strings 'Gus', Bob, and 'Ann'. Sample output for the given prog
    9·1 answer
  • A ____ is a software implementation of a computer that executes programs as if it were a real physical computer within the physi
    15·1 answer
  • Justify the statement "The same job title can have different job roles and different qualification criteria in different organiz
    7·1 answer
  • Write a loop to populate the list user_guesses with a number of guesses. The variable num_guesses is the number of guesses the u
    13·1 answer
  • The program DebugTwo2.cs has syntax and/or logical errors. Determine the problem(s) and fix the program.// This program greets t
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!