Question

In: Computer Science

Minimum of three shipment company quote - Code in Java Ashok is a rice trader from...

Minimum of three shipment company quote - Code in Java

Ashok is a rice trader from India and he wanted to send his supplies to Singapore. There are 3 shipment companies near his godown and he decided to choose the shipping company which gives him the minimum quotation for shipping his supplies.

Given the shipping quotations of three different shipping companies for Ashok's rice supplies, write a program to find the minimum quotation.

Problem Specification :

The File name should be Main.java.

Input Format:

The first input consists of an integer that corresponds to the quotation from "Mediterranean Shipping Company".

The second input consists of an integer that corresponds to the quotaion from "China Ocean Shipping Company(COSCO)".

The third input consists of an integer that corresponds to the quotation from "Evergreen Marine".

Output Format:

The output consists of String which corresponds to the shipping company name which is selected for shipping.
If more than one quotes are equal select the company based on the priority (Input entered order). Refer sample input and output.

[All text in bold corresponds to input and rest corresponds to output.]

Sample Input and Output 1:

65

89

56

Evergreen Marine

Sample Input and Output 2:

55

55

78

Mediterranean Shipping Company

Solutions

Expert Solution

Full working JAVA code:

import java.io.*;
import java.util.Scanner;
class Demo {
   public static void main (String[] args) {
   //Create object of scanner class to take user input
   Scanner sc = new Scanner(System.in);
   //Take 3 integer inputs from user
   int input1 = sc.nextInt();
   int input2 = sc.nextInt();
   int input3 = sc.nextInt();
   //Define variable min with input1 value
   int min = input1;
   //If input2 has smaller value than min, then update the min value
   if(input2 < min)
   min = input2;
   //Same with input3
   if(input3 < min)
   min = input3;
  
   //By now we got the minimum value of the three in varible "min"
   //Check if first value is only the minimum value and print the answer
   if(input1 == min)
   System.out.println("Mediterranean Shipping Company");
   //Check if second input has the lowest value
   else if(input2 == min)
   System.out.println("China Ocean Shipping Company(COSCO)");
   //If nothing works then input3 is the answer
   else
   System.out.println("Evergreen Marine");
   }
}

Input:

55
95
55

Output:

Mediterranean Shipping Company

Related Solutions

a. Assume you are a trader with Deutsche Bank. From the quote screen on your computer...
a. Assume you are a trader with Deutsche Bank. From the quote screen on your computer terminal, you notice that Dresdner Bank is quoting €0.855/$1.00 Credit Suisse is offering SF1.1825/$1.00. UBS’s current direct quoting €/SF currently @ € 0.754/SF i. (4pts) Prove and explain whether at these quoted rates there a chance for triangular arbitrage (Hint: Use the no arbitrage cross exchange rate here). ii. (8pts) Show and explain how you can make a triangular arbitrage profit by trading at...
Assume you are a trader with China Bank. From the quote screen on your computer terminal,...
Assume you are a trader with China Bank. From the quote screen on your computer terminal, you notice that Maybank is quoting RM_________/$1.00 (please refer to your assigned rate in the given table) and CIMB Bank is offering SGD___________/$1.00 (please refer to your assigned rate in the given table) . You learn that Public Bank is making a direct market between Malaysian ringgit and Singapore dollar, with a current RM/SGD quote of 3.015. Show how you can make a triangular...
AVL tree; Insert and Range Minimum operation in Java code.
AVL tree; Insert and Range Minimum operation in Java code.
Give the entire code for Minimum spanning tree using Boruvka's algorithm in java (not copy-pasted from...
Give the entire code for Minimum spanning tree using Boruvka's algorithm in java (not copy-pasted from any other website)
JAVA Write code which takes three decimal inputs from the user, creates a circle with a...
JAVA Write code which takes three decimal inputs from the user, creates a circle with a radius equal to the first input and a rectangle with length and width equal to the second and third input respectively, then prints both of these shapes. Sample run: Type a radius: 3.7 Type a length: 4.9 Type a width: 8.6 circle with radius 3.7 rectangle with length 4.9, width 8.6
Provide the Java code to compute the sum, average, maximum number and minimum number if I...
Provide the Java code to compute the sum, average, maximum number and minimum number if I have a string sentence of double numbers. Assume that the length of the string sentence is not known. It can be of any length. To split a string based on the comma character use the following. String sentence = "A,B,C,D,E"; String[] stringsArray = receivedSentence.split(","); Then stringsArray is an array of five elements such that: stringsArray[0] = 'A' stringsArray[1] = 'B' stringsArray[2] = 'C' stringsArray[3]...
Gold Star Rice, Ltd., of Thailand exports Thai rice throughout Asia. The company grows three varieties...
Gold Star Rice, Ltd., of Thailand exports Thai rice throughout Asia. The company grows three varieties of rice—White, Fragrant, and Loonzain. Budgeted sales by product and in total for the coming month are shown below: Product White Fragrant Loonzain Total Percentage of total sales 48 % 20 % 32 % 100 % Sales $ 364,800 100 % $ 152,000 100 % $ 243,200 100 % $ 760,000 100 % Variable expenses 109,440 30 % 121,600 80 % 133,760 55 %...
Gold Star Rice, Ltd., of Thailand exports Thai rice throughout Asia. The company grows three varieties...
Gold Star Rice, Ltd., of Thailand exports Thai rice throughout Asia. The company grows three varieties of rice—White, Fragrant, and Loonzain. Budgeted sales by product and in total for the coming month are shown below: Product White Fragrant Loonzain Total Percentage of total sales 48 % 20 % 32 % 100 % Sales $ 316,800 100 % $ 132,000 100 % $ 211,200 100 % $ 660,000 100 % Variable expenses 95,040 30 % 105,600 80 % 116,160 55 %...
Gold Star Rice, Ltd., of Thailand exports Thai rice throughout Asia. The company grows three varieties...
Gold Star Rice, Ltd., of Thailand exports Thai rice throughout Asia. The company grows three varieties of rice—White, Fragrant, and Loonzain. Budgeted sales by product and in total for the coming month are shown below: Product White Fragrant Loonzain Total Percentage of total sales 48 % 20 % 32 % 100 % Sales $ 292,800 100 % $ 122,000 100 % $ 195,200 100 % $ 610,000 100 % Variable expenses 87,840 30 % 97,600 80 % 107,360 55 %...
Gold Star Rice, Ltd., of Thailand exports Thai rice throughout Asia. The company grows three varieties...
Gold Star Rice, Ltd., of Thailand exports Thai rice throughout Asia. The company grows three varieties of rice—White, Fragrant, and Loonzain. Budgeted sales by product and in total for the coming month are shown below: Product White Fragrant Loonzain Total Percentage of total sales 20 % 52 % 28 % 100 % Sales $ 150,000 100 % $ 390,000 100 % $ 210,000 100 % $ 750,000 100 % Variable expenses 108,000 72 % 78,000 20 % 84,000 40 %...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT