Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- public class Main {
- public static void main(String[] args) throws IOException {
- banner();
- for(;;){
- malachi();
- BufferedReader BR= new BufferedReader (new InputStreamReader(System.in));
- System.out.println("Give an a value: ");
- int a= (int)Double.parseDouble(BR.readLine());
- System.out.println("Give a b value");
- int b= (int)Double.parseDouble(BR.readLine());
- stranded(a,b);
- }}
- public static void malachi() {
- System.out.println("\nPlease type a message here: ");
- Scanner scanner = new Scanner(System.in);
- String message = scanner.nextLine();
- }
- public static void stranded(int a, int b){
- int sum=a*b;
- int sum2= (int)Math.pow(a,b);
- System.out.println("The product is: "+ sum);
- System.out.println("a to the power of b is: " + sum2);
- Absolute(sum);
- }
- private static void Absolute(int sum){
- int result= (int)Math.abs(sum);
- System.out.println("The absolute value of the product of a*b: "+ result);
- }
- public static void banner(){
- System.out.println("Malachi Sor August 20m 2022");
- System.out.println("-----------------------------------------\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment