Answer to Question #206142 in Java | JSP | JSF for Lihle

Question #206142

You are required to create a console application that will capture a customer number and determine the value of the customers coin portfolio. The application must capture the customer number and the amount of silver, gold and platinum coins in a customer's portfolio.


1
Expert's answer
2021-06-11T22:34:40-0400
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package coinportfolio;
 import java.util.Scanner;
/**
 *
 * @author STUDENT
 */
public class CoinPortfolio {
    private int customer_number;
    private int silver;
    private int gold;
    private int platinum;
    public CoinPortfolio(int c, int s, int g, int p){
        customer_number = c;
        silver = s;
        gold = g;
        platinum = p;
        
    }
    void Portfolio_Type(float amount){
        System.out.print("COIN PORTFOLIO REPORT\t\n");
        System.out.print("**********************\t\n");
        System.out.println("CUSTOMER NUMBER:  \t"+customer_number);
        System.out.println("SIVER COINS:  \t"+silver);
        System.out.println("GOLD COINS:  \t"+gold);
        System.out.println("PLATINUM COINS:  \t"+platinum);
        System.out.println("TOTAL COINS VALUES  :  \t"+amount);
        if (amount >= 100000)
            System.out.println("ELITE PORTFOLIO\n");
            
        else
            System.out.println("STANDARD PORTFOLIO\n");
            
            
    }
    float Calculate(int s, int g, int p){
        return 250 * s + 525 * g + 875 * p;
    }


    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        int c,  s,  g,  p;
        Scanner input = new Scanner(System.in);
        System.out.print("Enter the customer number\t\n");
        c = input.nextInt();
        System.out.print("Enter the number of silver coins\t\n");
        s = input.nextInt();
        System.out.print("Enter the number of gold coins\t\n");
        g = input.nextInt();
        System.out.print("Enter the number of platinum coins\t\n");
        p = input.nextInt();
        CoinPortfolio folio = new CoinPortfolio(c,  s,  g,  p);
        float amount = folio.Calculate(s, g, p);
        folio.Portfolio_Type(amount);
        // TODO code application logic here
    }
    
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS