Java Programming, Loose-leaf Version
Java Programming, Loose-leaf Version
8th Edition
ISBN: 9781337685917
Author: Joyce Farrell
Publisher: Cengage Learning
bartleby

Videos

Expert Solution & Answer
Book Icon
Chapter 3, Problem 9PE

Explanation of Solution

Program code:

Insurance.java

//import the packages

import java.util.*;

//define the class Insurance

public class Insurance

{

//define the main() main

public static void main(String args[])

{

//Creating Scanner instance to scan console for User input

Scanner console = new Scanner(System.in);

//prompt the user to enter the current year

System.out.println("please enter the current year: ");

//scan for the user input

int currentyear = console.nextInt();

//prompt the user to enter the birth year

System.out.println("please enter ur birth year : ");

//scan for the input

int birthyear= console.nextInt();

//method calling by paasing values

int premium=premiumAmount(currentyear,birthyear);

//print the value of premium

System.out.println("total premium amount :\t$"+premium);

}

//define the method premiumAmount()

public static int premiumAmount(int cy,int by)

{

//declare an integer variable

int age=cy-by;

//print the age

System.out.println("Age is : "+age);

//divide the age by 10 and save to d

int d=(age)/10;

//print the value of d

System.out.println("decade is : "+d);

//add 15 to d and save to add

int add=d+15;

//return the value

return(add*20);

}

}

Explanation:

The above snippet of code is used create a class “insurance” to declare the static methods to calculate the premium...

Blurred answer
Students have asked these similar questions
We are considering the RSA encryption scheme. The involved numbers are small, so the communication is insecure.  Alice's public key (n,public_key) is (247,7). A code breaker manages to factories  247 = 13 x 19  Determine Alice's secret key. To solve the problem, you need not use the extended Euclid algorithm, but you may assume that her private key is one of the following numbers 31,35,55,59,77,89.
Consider the following Turing Machine (TM). Does the TM halt if it begins on the empty tape? If it halts, after how many steps? Does the TM halt if it begins on a tape that contains a single letter A followed by blanks? Justify your answer.
Pllleasassseee ssiiirrrr soolveee thissssss questionnnnnnn
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
CPP Function Parameters | Returning Values from Functions | C++ Video Tutorial; Author: LearningLad;https://www.youtube.com/watch?v=WqukJuBnLQU;License: Standard YouTube License, CC-BY