Question

In: Computer Science

Evaluate Grade for Shipping Company - Code in Java There are many Shipping companies emerging in...

Evaluate Grade for Shipping Company - Code in Java


There are many Shipping companies emerging in the market now. 'SaySo' online survey panel has come up with the strategy to choose the best Shipping Company for your shipping needs. The survey panel has taken into consideration two factors of the companies namely the number of countries a shipping Company offers its services (country coverage) and number of shipments done per month. The survey panel has graded the companies based on the two factors as given below:

Grade Countries Shipment per month
A Above 150 Above 1500
B Above 125 Above 1200
C Above 100 Above 1000
D Above 75 Above700
E <=75 and >=0 <=700 and >=0
Invalid Input < 0 < 0


Write the program to find the grade under which a specific Company falls, given the number of countries it offers services and the number of shipments made.

Problem Specfication :
The file name should be Main.java.

Input Format :
The first input consists of an integer that corresponds to the number of countries the company offer its services.
The second input consists of an integer that corresponds to the number of shipments per month.

Output Format :
The output should display the Grade of company. Print 'Invalid Input' otherwise.
Refer sample input and output for formatting specifications.

[All text in bold corresponds to input and rest corresponds to output.]
Sample Input and Output 1:
Enter the total number of countries :
150
Enter the total number of shipment per month :
1550
The company grade is : B

Sample Input and Output 2:
Enter the total number of countries :
-12
Enter the total number of shipment per month :
450
Invalid Input

Don'ts:
      1. Do not create packages for classes. Strictly adhere to the program structure given in the template code.
      2. Do not use Internet Explorer, highly recommended to use chrome browser to launch ebox platform.
      3. Do not create multiple classes inside a single file. Create separate file for each class.

Solutions

Expert Solution

Please refer to the screenshot of the code to understand the indentation of the code and output

Code

// Import the Scanner class
import java.util.Scanner;

public class Main{

   public static void main(String[] args) {
  
   // create a number of countries variable
   int countries;
   //create a number of shipment variable
   int shipment;
// Create a Scanner object     
   Scanner myObj = new Scanner(System.in);
   // print the number of countries
   System.out.println("Enter the total number of countries :");
   // take input from user for the number of countries and assign to countries variable
   countries = myObj.nextInt();
   // print the number of shipment to ask the user
   System.out.println("Enter the total number of shipment per month :");
   // take input from user for the number of shipments and assign to shipment variable
   shipment = myObj.nextInt();
  
   // checks if no. of countries entered are greater than 150 and shipment are greater than 1500
   if (countries > 150 && shipment > 1500)
   {
   // prints grade A
   System.out.println("The company grade is : A");
   }
   // checks if no. of countries entered are greater than 125 and shipment are greater than 1200
   else if (countries > 125 && shipment > 1200)
   {
   // prints grade B
   System.out.println("The company grade is : B");
   }
   // checks if no. of countries entered are greater than 100 and shipment are greater than 1000
   else if (countries > 100 && shipment > 1000)
   {
   // prints grade C
   System.out.println("The company grade is : C");
   }
   // checks if no. of countries entered are greater than 75 and shipment are greater than 700
   else if (countries > 75 && shipment > 700)
   {
   // prints grade D
   System.out.println("The company grade is : D");
   }
   // checks if no. of countries entered are greater than or equal to 0 and less than or equal to 75
   //checks if shipment are greater than or equal to 0 and less than or equal to 700
   else if ((countries <= 75 && countries >=0) && (shipment <= 700 && shipment >=0))
   {
   // prints grade E
   System.out.println("The company grade is : E");
   }
   // if none of the above conditions satisfies,it prints Invalid Input
   else
   {
   // prints Invalid Input
   System.out.println("Invalid Input");
   }
  
   }
}

Output

Enter the total number of countries :                                                                                   

160                                                                                                                     

Enter the total number of shipment per month :                                                                          

1509                                                                                                                    

The company grade is : A

Code Screenshot

Output Screenshot

output for invalid input


Related Solutions

The code is needed in Java. There are many ways to design a solution to this...
The code is needed in Java. There are many ways to design a solution to this problem but you are evaluated on meeting the specific specifications as given in this quiz. Use proper statement indentation and meaningful variable names in the code. (3 points) Place a multi-line comment (not multiple single line comments) giving a description of what this application does before the class header. Include your name and the date with the description. (2 points) Output spacing, formatting, and...
This code in java: A typical ball is circular in shape. Many games are played with...
This code in java: A typical ball is circular in shape. Many games are played with ball e.g cricket ball football etc. Impingement a scenario in which you create cricket ball and football or any other game ball. All balls differ in color, size and material
Please use Java language! With as many as comment! ThanksWrite a static method called "evaluate"...
In Java language Write a static method called "evaluate" that takes a string as a parameter. The string will contain a postfix expression, consisting only of integer operands and the arithmetic operators +, -, *, and / (representing addition, subtraction, multiplication, and division respectively). All operations should be performed as integer operations. You may assume that the input string contains a properly-formed postfix expression. The method should return the integer that the expression evaluates to. The method MUST use a stack...
Can you provide java code for a program that prompts the user by asking "How many...
Can you provide java code for a program that prompts the user by asking "How many one mile races have you ran?". After the user inputs how many one mile races have they run it then prompts the user to input how many seconds it took for them to finish each race. So for example, if the user ran 6 races then the user will have to input 6 race times. Is there a way when you prompt the user...
Write a java code that first discards as many whitespace characters as necessary until the first...
Write a java code that first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical digits as possible, and interprets them as a numerical value. The string can contain additional characters after those that form the integral number, which are ignored and have no effect on the behavior of this function. If the first sequence of non-whitespace...
Write a java code to find the following. For numbers 501 to 999, how many numbers...
Write a java code to find the following. For numbers 501 to 999, how many numbers will have the sum of the digits equal to 10. 501, sum of digits=6 502, sum of digits=7 503, sum of digits=8 504, sum of digits=9 505, sum of digits=10 506, sum of digits=11
How should companies and investors measure success in emerging markets?
How should companies and investors measure success in emerging markets?
Evaluate three emerging issues that relate to the implementation of IT systems and the related impact...
Evaluate three emerging issues that relate to the implementation of IT systems and the related impact to the fraud environment. Recommend a risk mitigation strategy associated with installing a new database system, and determine the impact of designing an effective internal control audit plan to determine whether those risks have been identified.
JAVA JAVA JAVA Hey i need to find a java code for my homework, this is...
JAVA JAVA JAVA Hey i need to find a java code for my homework, this is my first java homework so for you i don't think it will be hard for you. (basic stuff) the problem: Write a complete Java program The transport Company in which you are the engineer responsible of operations for the optimization of the autonomous transport of liquid bulk goods, got a design contract for an automated intelligent transport management system that are autonomous trucks which...
Offices are getting more casual. Companies relax their formal dress code for many reasons: they want...
Offices are getting more casual. Companies relax their formal dress code for many reasons: they want to attract top candidates, to create a more relaxed work environment and to allow employees to be creative with their dress, which may translate to job creativity and productivity. Two large companies, Company A and Company B, are considering whether they should relax the dress code for their office workers as well. Independently, they randomly sampled their office employees to collect their opinions, and...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT