- codewithshiva

Latest

Search Bar

Friday, July 2, 2021

 Tickets Booking

Description

You are provided price of three different types of ticket: 1st Class, 2nd class and 3rd class.

Also, you know the number of tickets of each type you need to book. Find total cost you need to pay.

Input

Input Format:

First line contains 3 space separated positive integers which represents prices of 1st class, 2nd class and 3rd class respectively.

Second line contains 3 space separated integers which is the number of tickets you need to buy of 1st class, 2nd class and 3rd class respectively.

Constraints:

All provided numbers <10000

Output

Output one number which is the price of all tickets to be booked.

Sample Input 1 

1200 1400 2000
5 6 2

Sample Output 1

18400
import java.util.Scanner;

public class Main {

public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] price =new int[3];
int[] number =new int[3];
for (int i =0; i<=2;i++){
price[i]= sc.nextInt();
}
for (int i =0; i<=2;i++){
number[i]= sc.nextInt();
}
int sum=0;
for (int i =0; i<3;i++){
sum=price[i]*number[i]+sum;
}
System.out.println(sum);

}
}

No comments:

Post a Comment