import java.util.Scanner; public class BooleanExpression2 { public static void main(String[] args) { /* Question 4. write a program that increases score by 3 % if attendance is greater than 9 and displays the final score. */ Scanner scanner = new Scanner(System.in); System.out.println("Enter your score, Please: "); double score = scanner.nextDouble(); //data type System.out.println("Enter the days you have attended, Please: "); int attendence = scanner.nextInt(); if(attendence > 9) { score = score + score * 0.03; } System.out.println("Your final score is: "+score); } } //output: /*Please Enter your score: 80 Please Enter your attendence: 10 Your final score is= 82.4 */
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter