top of page

PROGRAMMING

Graphics

i) Program 1 : Hello World !

       Program "Hello World !" was carried out using Java Programming to solve problems related to text display. It is to display text or sentences in Java by using Java Programming. To make this program successful, it needs to follow some correct steps. In addition, the file name also needs to be changed carefully according to the file name that is set correctly. It's a basic, short program that shows the phrase "Hello, World!" on the screen. It is usually used to explain a new programming language to beginners. Any line in Java that starts with "/" is a comment. Meanwhile, comments are included in the code to help users understand the program's goals and functions.

       To make this programming program "Hello World" I use eclipse, by creating Java Project name and project name, I name this programming project with the name Hello. Next, I 'right click' on the project folder that appears under 'package explorer' and click on the class to select it. In the new java class I named the class hello and I chose methods to create 'public static void main(String[] args)' and 'inherited abstract methods' methods.

       Then in the java application we type 'sysout' which is a shortcut method and press control and space and it comes out 'System.out.printIn();' For now, just remember that the main function is the entry point of your Java application, and it's needed in any Java application. After that, I create 'System.out.printIn();' this by naming this object as ("Hello World"). Before that, I deleted the 'module' first because there was an error. Finally, I clicked the Run button. The print statement is the above code. The text "Hello World!" written to standard output. In Java, data inside a quote is referred to as a String.

 

Therefore, below is the code format that has been used to produce program one which is "Hello World!"  :

 

// Your First Program

 

class HelloWorld {

    public static void main(String[] args) {

        System.out.println("Hello, World!"); 

    }

}

 

Output :

Hello, World!

Screenshot (537).png
Graphic Shapes

ii ) Program 2 : Temperature Converter (Fahrenheit <-> Celsius)

       The second program carried out is "Temperature converter (Fahrenheit <-> Celsius)". It has been carried out using Java Programming to solve problems related to unit conversion to calculate temperature, that is to make a conversion calculation from degrees Celsius to Fahrenheit. In order to realize this program, it needs to follow some correct format. In addition, the file name also needs to be changed carefully according to the file name that is set correctly. After running the program, the data was obtained.

       The formula is Celsius = (Fahrenhite – 32). Fahrenheit and Celsius are temperature variables measured in degrees and written as ℉ and ℃ respectively. The double variable is needed because we have to work with decimal numbers. Through multiple variables, it can calculate and hold decimal numbers simultaneously. Whereas, the example we can compare is an integer that can only count and maintain integers, unlike double variables.

       So to make this 'Fahrenheit <-> Celsius' temperature conversion programming program I use eclipse, by creating Java Project name and project name, I name this programming project with the name 'JavaProgramtoConvertCelsiusintoFehrenheit'. Next, I 'right click' on the project folder that appears under 'package explorer' and click on the class to select it. In my new java class by naming the class (CelsiustoFehrenheit) and I select  methods to create 'public static void main(String[] args)' and 'inherited abstract methods' methods.

       Then in the java application I type 'sysout' which is a shortcut method and press control and space and it comes out 'System.out.printIn();' ("Enter degrees Fahrenheit: ");". I created 'System.out.printIn();' this by naming this object as ("celsiustofahrenheit") Finally, type the number of degrees Fahrenheit you want to see the result. Before that, I delete the 'module' first. Finally, I click the run button (Run).

Therefore, below is the code format that has been used to produce program 2:

// Java Program to Convert Celsius into Fahrenheit

class celsiustofahrenheit {

public static void main(String[] args)

{

// initialising

double celsius = 10.0, fahrenheit = 0.0;

 

// formula for conversion

fahrenheit = (celsius * 1.8) + 32;

System.out.println(

" value of temperature in fahrenheit:"

+ fahrenheit);

}

}

 

Output : 

value of temperature in fahrenheit: 50.0

 

FERENHEIT.png
Graphic Chart

iii) Program 3 : BMI Calculator Without Interface

        The Body Mass Index (BMI) Calculator program is designed to solve the problem of calculating human BMI. It can be used to calculate BMI values ​​based on height and weight. BMI is a reliable indicator of body fatness for most people. There are three inputs obtained after creating this program. Calculate your BMI in seconds to see which group you belong to. BMI can be used to identify whether a person is underweight, overweight or obese

​      To make a BMI calculator programming program without this interface, I use eclipse, by creating Java Project name and project name, I name this programming project with the name 'BMICalculator'. Next, I 'right click' on the project folder that appears under 'package explorer' and click on the class to select it. In my new java class by naming the class (BMI) and I choose methods to create 'public static void main(String[] args)' and 'inherited abstract methods' methods.

       Then in the java application I type 'sysout' which is a shortcut method and press control and space and it comes out 'System.out.printIn();' , after that, I create 'System.out.printIn();' this by naming this object as ("BMICalculator"). Before that, I deleted the 'module' first. After that, I clicked the run application button. Next, it shows weight and height, so we need to enter the total weight in kg and height in meters. Finally, press 'enter' to see if the total BMI is normal, thinness, overweight, or obese.

Below is the code format that has been used to produce program 3:

import java.util.Scanner;

 

public class BMICalculator {

 

   // method to check bmi category

   public static String bmiCategory(double weight, 

                                    double height) {

 

      // calculate bmi

      double bmi = weight / ( height * height) ;

 

      // check range

      if(bmi < 18.5)

         return "Thinness";

      else if(bmi < 25)

         return "Normal";

      else if(bmi < 30)

         return "Overweight";

      else

         return "Obese";

   }

 

   public static void main(String[] args) {

 

      // declare variables

      double weightInKg = 0.0f;

      double heightInMeters = 0.0f;

      String result = null;

 

      // create Scanner class object to

      // take input

      Scanner scan = new Scanner(System.in);

      System.out.print("Enter weight in Kg: ");

      weightInKg = scan.nextDouble();

      System.out.print("Enter height in meters: ");

      heightInMeters = scan.nextDouble();

 

      // calculate BMI index

      result = bmiCategory( weightInKg, 

                           heightInMeters );

 

      // display result

      System.out.println(result);

 

      // close Scanner class object

      scan.close();

   }

}

Output:

Enter weight in Kg : 50

Enter Height in Meters : 1.56

Normal

BMI.png
Abstract Background

iv) Program 4 : Pattern Program

This program is done to solve problems to produce various patterns. It is to generate some random patterns based on the number of roles entered. In addition, it is also to understand how the program can work. Through the production of this program it can improve programming skills, logic and loops. Java pattern code can be printed in various styles that we want. It is to evaluate the logic and reasoning of the programmer. To learn pattern programming, we need to have an understanding through Java loops, such as do-while for loops.

Pattern 1 : Diamond Shape Pattern Program in Java

         To make this Pattern programming program I use eclipse, by creating Java Project name and project name, I name this programming project with the name 'Pattern1'. Next, I 'right click' on the project folder that appears under 'package explorer' and click on the class to select it. In the new java class I named the class "DiamondShape". Rows are marked with I while columns are marked with j. I chose the method to create 'public static void main(String[] args)' and 'inherited abstract methods' methods. Before that, I deleted the 'module' first. Then write System.out.println("Enter line:");. Finally, I click the run application button.

Below is one of the code formats that have been used to produce the first pattern program:

import java.util.Scanner;

public class DiamondShape

 

{

public static void main(String args[])

{

int n, i, j, space = 1;

System.out.print("Enter the number of rows: ");

Scanner s = new Scanner(System.in);

n = s.nextInt();

space = n - 1;

for (j = 1; j<= n; j++)

{

for (i = 1; i<= space; i++)

{

System.out.print(" ");

}

space--;

for (i = 1; i <= 2 * j - 1; i++)

{

System.out.print("*");

}

System.out.println("");

}

space = 1;

for (j = 1; j<= n - 1; j++)

{

for (i = 1; i<= space; i++)

{

System.out.print(" ");

}

space++;

for (i = 1; i<= 2 * (n - j) - 1; i++)

{

System.out.print("*");

}

System.out.println("");

}

}

}

Output : 

*

***

*****

*******

*********

*******

*****

***

*

Screenshot (692).png
Abstract Background

Pattern 2 : Sandglass Star Pattern

I have created Java Project name and project name, I named this programming project with name 'Pattern2'. Next, I 'right click' on the project folder that appears under 'package explorer' and click on the class to select it. In the new java class I named the class "Sandglass" and I chose the method to create the method 'public static void main(String[] args)' and 'inherited abstract methods'. Before that, I deleted the 'module' first. Finally, I click the run application button.

Below is one of the code formats that have been used to produce the second pattern program:

Screenshot (695).png

import java.util.Scanner;

public class Sandglass

 

{

    public static void main(String[] args)

    {

        Scanner sc = new Scanner(System.in);

        System.out.println("Enter the number of rows: ");

 

        int rows = sc.nextInt();       

        for (int i= 0; i<= rows-1 ; i++)

        {

            for (int j=0; j <i; j++)

            {

                System.out.print(" ");

            }

            for (int k=i; k<=rows-1; k++) { System.out.print("*" + " "); } System.out.println(""); } for (int i= rows-1; i>= 0; i--)

        {

            for (int j=0; j< i ;j++)

            {

                System.out.print(" ");

            }

            for (int k=i; k<=rows-1; k++)

            {

                System.out.print("*" + " ");

            }

            System.out.println("");

        }

        sc.close();

    }

}

 

 

 

Output : 

* * * * *

* * * *

* * *

* *

*

*

* *

* * *

* * * *

* * * * * 

Connecting Dots

Pattern 3 :  Triangle Star pattern

I created Java Project name and project name, I named this programming project with name 'Pattern3'. Next, I 'right click' on the project folder that appears under 'package explorer' and click on the class to select it. In the new java class I named the class "TriangleStarPattern" and I chose methods to create 'public static void main(String[] args)' and 'inherited abstract methods' methods. Before that, I deleted the 'module' first. Finally, I click the run application button.

Below is one of the code formats that have been used to produce the third pattern program:

import java.util.Scanner;

public class TriangleStarPattern

 

{

     public static void main(String[] args)

        {

            Scanner sc = new Scanner(System.in);

 

            System.out.println("Enter the number of rows: ");

 

            int rows = sc.nextInt();

             

            for (int i=1; i<= rows ; i++)

            {

                for (int j = i; j < rows ; j++) {

                    System.out.print(" ");

                }  

                for (int k = 1; k <= (2*i -1) ;k++) {

                    if( k==1 || i == rows || k==(2*i-1)) {

                        System.out.print("*");

                    }

                    else {

                        System.out.print(" ");

                    }

                }

                System.out.println("");

            }

            sc.close();

        }

    }

 

Output : 

   *

   * *

  *   *

 *     *

 *********

Screenshot (697).png
Abstract Background

Pattern 4 : Zeros/ ones Pattern Programs

I created Java Project name and project name, I named this programming project with name 'Pattern4'. Next, I 'right click' on the project folder that appears under 'package explorer' and click on the class to select it. In the new java class I named the class "ZerosNumberPattern" and I chose methods to create 'public static void main(String[] args)' and 'inherited abstract methods'. Before that, I deleted the 'module' first. Finally, I click the run application button.

Below is one of the code formats that have been used to produce the fourth pattern program:

import java.util.Scanner;

 

public class ZerosNumberPattern

 

{       

    public static void main(String[] args)

    {

        Scanner sc = new Scanner(System.in);

          

        System.out.println("Enter the number of rows: ");

          

        int rows = sc.nextInt();    

        for (int i = 1; i <= rows; i++)

        {

            for (int j = 1; j <= i; j++)

            {

                if(j%2 == 0)

                {

                    System.out.print(0);

                }

                else

                {

                    System.out.print(1);

                }

            }

              

            System.out.println();

        }

          

        sc.close();

    }

}

Output : 

1

10

101

1010

10101

Screenshot (696).png
White Abstract

Program 5 : BMI Calculator with Interface

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
 
/**
*
* @author H2O
*/
public class JavaExamples extends javax.swing.JFrame {
 
    JavaExamples() {
        JFrame f = new JFrame();//creating instance of JFrame  
 
        JLabel lb1 = new JLabel("Height(Inches):");
        lb1.setBounds(20, 20, 100, 40);//x axis, y axis, width, height
        f.add(lb1); //adding component in JFrame
 
        JLabel lb2 = new JLabel("Weight(Pounds):");
        lb2.setBounds(20, 60, 100, 40);//x axis, y axis, width, height
        f.add(lb2); //adding component in JFrame 
        
        JLabel lbResult = new JLabel("BMI Calculator in JAVA GUI");
        lbResult.setBounds(20, 90, 300, 40);//x axis, y axis, width, height
        f.add(lbResult); //adding component in JFrame 
        
        JTextField txtHeight = new JTextField("");
        txtHeight.setBounds(120, 20, 200, 40);//x axis, y axis, width, height
        f.add(txtHeight); //adding component in JFrame 
 
        JTextField txtWeight = new JTextField("");
        txtWeight.setBounds(120, 60, 200, 40);//x axis, y axis, width, height
        f.add(txtWeight); //adding component in JFrame 
 
        JButton btn = new JButton("BMI Calculator in JAVA GUI(CALCULATE)");//creating instance of JButton  
        btn.setBounds(20, 130, 300, 40);//x axis, y axis, width, height
        
        //Event
        btn.addActionListener(new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent e) {
                
                double weight=Double.parseDouble(txtWeight.getText());
                double height=Double.parseDouble(txtHeight.getText());
                
                double bmi = weight / Math.pow(height, 2) * 703;
 
                 if (bmi < 18.5) {
                     lbResult.setText("underweight - BMI : "+bmi);
                 } else if (bmi < 25) {
                     lbResult.setText("normal - BMI : "+bmi);
                 } else if (bmi < 30) {
                     lbResult.setText("overweight - BMI : "+bmi);
                 } else {
                     lbResult.setText("obese - BMI : "+bmi);
                 }
            }
        });
 
        f.add(btn);//adding button in JFrame  
 
        f.setSize(400, 300);
        f.setLayout(null);
        f.setVisible(true);
 
    }
 
    public static void main(String[] args) {
        new JavaExamples();
    }
}

WhatsApp Image 2023-01-04 at 11.05.12 AM.jpeg

To improve this program, I have improved the inputs related to BMI results in the sources section. Therefore, below is one of the things I have changed.

 

 

//Event

btn.addActionListener(new ActionListener(){

@Override

public void actionPerformed(ActionEvent e) {

 

double weight=Double.parseDouble(txtWeight.getText());

double height=Double.parseDouble(txtHeight.getText());

 

double bmi = weight / Math.pow(height, 2) * 10000 ;

 

if (bmi < 18.5) {

lbResult.setText("underweight - BMI : "+bmi);

} else if (bmi < 24.9) {

lbResult.setText("normal - BMI : "+bmi);

} else if (bmi < 29.9) {

lbResult.setText("overweight - BMI : "+bmi);

} else {

lbResult.setText("obese - BMI : "+bmi);

}

}

});

The picture below shows a calculator program with an interface:

The Body Mass Index (BMI) Calculator program with an interface is carried out to solve the problem of calculating human BMI by showing an attractive and creative interface and benefiting users in understanding it easily when using it. It can be used to calculate BMI values ​​based on height and weight. To create a BMI is a reliable indicator of body fatness for most people. There are several inputs obtained after making this program.

​           To create a BMI calculator programming program with this interface, I used eclipse, by selecting "Swing - JFrame" and  I named it with the name 'InterfaceBMICalculator' first. Further, before I continue with other processes, I edit the "window" first so that I can see both "sources and design" sections. I 'right click' on the project folder that appears under 'package explorer' and click on the class to select it. In the new java class, I named the class (InterfaceBMICalculator) and I chose methods to create 'public static void main(String[] args)' and 'inherited abstract methods' methods.

Next, I created and named it as ("InterfaceBMICalculator"). Before that, I deleted the 'module' first. After that, I put the unedited code in the sources section. I started clicking the run app button to test it. And found it needs to be fixed. Therefore, I started focusing on improving the sources first.

Among the codes I changed was the code to give instructions in the form of weight which was originally in units of inches changed to units of kg. Meanwhile, the height which was originally in the unit of pounds was changed to the unit of cm. because it is to facilitate users who are mostly from Malaysia. Not only that, I have also changed the codes for the classification of 'thinnes, normal, overweight, and obese'.

Next, I designed the interface of my BMI calculator by focusing on the design part. First of all I use and add components like "JLabel" to create headings and subheadings in my calculator design. For example,("IbINewLabel-" "DAILY BMI CALCULATOR"). In this process I played a lot with colors and typefaces and appropriate sizes until I got the interface design I wanted. Next, for the box that needs to be filled in by the user, I use the "JTextField" component for the space to fill in the amount of weight and height. Meanwhile, to create a heavy and tall text design, I use "ExtHeight-" and txtWeight-". Next, I also use "JBotton" to be the user's BMI calculation botton and use "JLabel" to create a BMI result display (IbResult - "Your Results :").

Furthermore, I use "JLabel"  to add my interface calculator design (IbINewLabel1 - "Name :1 textField) with name and age. Not only that, I also use "JCheckBox" (2 chckbxNewCheckBox - "Male"Y chckbxNewCheckBox1 - "Female") for the user to make a gender selection (IbINewLabel 2 - "Gender :"). I also created another interface design using the "JRadioBotton" for the user to choose the frequency of exercise done every week (IbINewLabel 3 - "Exercise Level :" © rdbtnNewRadioButton - "More than 3 times / week" "©rdbtnNewRadioButton 1 - "Less than 3 times / week"). To move and arrange bottons etc I use "AbsoluteLayout".

Finally, I improved the interface design of my calculator by using "JLabel" and adjusting the size of the box according to the size of the picture to be included. To insert a picture, I press the "icon" and click "Absolute path in file system", it is to determine the mode of the picture to be inserted. After determining the image mode, I click on "Browse" to select the image in the computer file that I want to use on my interface. After being satisfied, I click ok. By using this method, I included some appropriate pictures and icons to produce a suitable interface design for this program.

Below is the code format that has been used to produce program 3:

Screenshot (777)
Screenshot (778)
Screenshot (773)
White Abstract

This is the last code I improved, it is the code I used to produce this fifth program which is a calculator program with an interface:

 

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import java.awt.Font;
import java.awt.Color;
import javax.swing.JRadioButton;
import javax.swing.JCheckBox;
import javax.swing.JSpinner;
import javax.swing.JComboBox;
import javax.swing.ImageIcon;
 
/**
*
* @author H2O
*/
public class InterfaceBMIcalculator extends javax.swing.JFrame {
   private JTextField textField;
   private JTextField textField_1;
 
   InterfaceBMIcalculator() {
        JFrame f = new JFrame();//creating instance of JFrame  
        f.getContentPane().setBackground(new Color(255, 255, 255));
 
        JLabel lb1 = new JLabel("Height (Cm) :");
        lb1.setForeground(new Color(0, 64, 128));
        lb1.setFont(new Font("Tahoma", Font.BOLD, 15));
        lb1.setBounds(215, 399, 106, 40);//x axis, y axis, width, height
        f.getContentPane().add(lb1); //adding component in JFrame
 
        JLabel lb2 = new JLabel("Weight (Kg) :");
        lb2.setForeground(new Color(0, 64, 128));
        lb2.setFont(new Font("Tahoma", Font.BOLD, 15));
        lb2.setBounds(212, 446, 106, 40);//x axis, y axis, width, height
        f.getContentPane().add(lb2); //adding component in JFrame 
        
        JLabel lbResult = new JLabel("Your Result :");
        lbResult.setForeground(new Color(0, 0, 128));
        lbResult.setFont(new Font("Tahoma", Font.BOLD, 17));
        lbResult.setBounds(236, 576, 457, 40);//x axis, y axis, width, height
        f.getContentPane().add(lbResult); //adding component in JFrame 
        
        JTextField txtHeight = new JTextField("");
        txtHeight.setFont(new Font("Tahoma", Font.BOLD, 13));
        txtHeight.setForeground(new Color(0, 0, 128));
        txtHeight.setBackground(new Color(135, 206, 250));
        txtHeight.setBounds(341, 403, 200, 34);//x axis, y axis, width, height
        f.getContentPane().add(txtHeight); //adding component in JFrame 
 
        JTextField txtWeight = new JTextField("");
        txtWeight.setForeground(new Color(0, 0, 128));
        txtWeight.setFont(new Font("Tahoma", Font.BOLD, 13));
        txtWeight.setBackground(new Color(135, 206, 250));
        txtWeight.setBounds(341, 451, 200, 34);//x axis, y axis, width, height
        f.getContentPane().add(txtWeight); //adding component in JFrame 
 
        JButton btn = new JButton("CALCULATE YOUR BMI ");//creating instance of JButton  
        btn.setBackground(new Color(0, 0, 128));
        btn.setForeground(new Color(255, 255, 255));
        btn.setFont(new Font("Tahoma", Font.BOLD, 15));
        btn.setBounds(310, 508, 261, 44);//x axis, y axis, width, height
        
        //Event
        btn.addActionListener(new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent e) {
                
                double weight=Double.parseDouble(txtWeight.getText());
                double height=Double.parseDouble(txtHeight.getText());
                
                double bmi = weight / Math.pow(height, 2) * 10000 ; 
 
                 if (bmi < 18.5) {
                     lbResult.setText("underweight - BMI : "+bmi);
                 } else if (bmi < 24.9) {
                     lbResult.setText("normal - BMI : "+bmi);
                 } else if (bmi < 29.9) {
                     lbResult.setText("overweight - BMI : "+bmi);
                 } else {
                     lbResult.setText("obese - BMI : "+bmi);
                 }
            }
        });
 
        f.getContentPane().add(btn);//adding button in JFrame  
 
        f.setSize(851, 741);
        f.getContentPane().setLayout(null);
        
        JLabel lblNewLabel = new JLabel("DAILY BMI CALCULATOR");
        lblNewLabel.setForeground(new Color(135, 206, 250));
        lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 25));
        lblNewLabel.setBounds(261, 117, 329, 34);
        f.getContentPane().add(lblNewLabel);
        
        JLabel lblNewLabel_1 = new JLabel("Name : ");
        lblNewLabel_1.setForeground(new Color(0, 64, 128));
        lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 15));
        lblNewLabel_1.setBounds(177, 181, 72, 21);
        f.getContentPane().add(lblNewLabel_1);
        
        textField = new JTextField();
        textField.setFont(new Font("Tahoma", Font.BOLD, 13));
        textField.setForeground(new Color(0, 0, 128));
        textField.setBackground(new Color(135, 206, 250));
        textField.setBounds(246, 174, 174, 34);
        f.getContentPane().add(textField);
        textField.setColumns(10);
        
        JLabel lblNewLabel_2 = new JLabel("Gender :");
        lblNewLabel_2.setForeground(new Color(0, 64, 128));
        lblNewLabel_2.setFont(new Font("Tahoma", Font.BOLD, 15));
        lblNewLabel_2.setBounds(236, 263, 72, 13);
        f.getContentPane().add(lblNewLabel_2);
        
        JCheckBox chckbxNewCheckBox = new JCheckBox("Male");
        chckbxNewCheckBox.setForeground(new Color(0, 0, 128));
        chckbxNewCheckBox.setBackground(new Color(255, 255, 255));
        chckbxNewCheckBox.setFont(new Font("Tahoma", Font.BOLD, 13));
        chckbxNewCheckBox.setBounds(329, 260, 79, 21);
        f.getContentPane().add(chckbxNewCheckBox);
        
        JCheckBox chckbxNewCheckBox_1 = new JCheckBox("Female");
        chckbxNewCheckBox_1.setForeground(new Color(0, 0, 128));
        chckbxNewCheckBox_1.setBackground(new Color(255, 255, 255));
        chckbxNewCheckBox_1.setFont(new Font("Tahoma", Font.BOLD, 13));
        chckbxNewCheckBox_1.setBounds(428, 261, 72, 21);
        f.getContentPane().add(chckbxNewCheckBox_1);
        
        JLabel lblNewLabel_3 = new JLabel("Exercise Level :");
        lblNewLabel_3.setForeground(new Color(0, 64, 128));
        lblNewLabel_3.setFont(new Font("Tahoma", Font.BOLD, 15));
        lblNewLabel_3.setBounds(184, 319, 122, 13);
        f.getContentPane().add(lblNewLabel_3);
        
        JRadioButton rdbtnNewRadioButton = new JRadioButton("More than 3 times / week");
        rdbtnNewRadioButton.setForeground(new Color(0, 0, 128));
        rdbtnNewRadioButton.setBackground(new Color(255, 255, 255));
        rdbtnNewRadioButton.setFont(new Font("Tahoma", Font.BOLD, 13));
        rdbtnNewRadioButton.setBounds(329, 316, 200, 21);
        f.getContentPane().add(rdbtnNewRadioButton);
        
        JRadioButton rdbtnNewRadioButton_1 = new JRadioButton("Less than 3 times / week");
        rdbtnNewRadioButton_1.setForeground(new Color(0, 0, 128));
        rdbtnNewRadioButton_1.setBackground(new Color(255, 255, 255));
        rdbtnNewRadioButton_1.setFont(new Font("Tahoma", Font.BOLD, 13));
        rdbtnNewRadioButton_1.setBounds(329, 339, 200, 21);
        f.getContentPane().add(rdbtnNewRadioButton_1);
        
        JLabel lblNewLabel_4 = new JLabel("Age :");
        lblNewLabel_4.setForeground(new Color(0, 64, 128));
        lblNewLabel_4.setFont(new Font("Tahoma", Font.BOLD, 15));
        lblNewLabel_4.setBounds(461, 181, 45, 21);
        f.getContentPane().add(lblNewLabel_4);
        
        textField_1 = new JTextField();
        textField_1.setFont(new Font("Tahoma", Font.BOLD, 13));
        textField_1.setForeground(new Color(0, 0, 128));
        textField_1.setBackground(new Color(135, 206, 250));
        textField_1.setBounds(516, 175, 122, 34);
        f.getContentPane().add(textField_1);
        textField_1.setColumns(10);
        
        JLabel lblNewLabel_7 = new JLabel("");
        lblNewLabel_7.setIcon(new ImageIcon("C:\\Users\\M S I\\Downloads\\360_F_512552918_Ozdl6fVxzqsT5IgbZnMSkv4LlwIkS6OF (3).jpg"));
        lblNewLabel_7.setBounds(309, 25, 180, 94);
        f.getContentPane().add(lblNewLabel_7);
        
        JLabel lblNewLabel_5 = new JLabel("");
        lblNewLabel_5.setIcon(new ImageIcon("C:\\Users\\M S I\\Downloads\\BMI-image-sahyadri (4).png"));
        lblNewLabel_5.setBounds(577, 480, 261, 224);
        f.getContentPane().add(lblNewLabel_5);
        f.setVisible(true);
 
    }
 
    public static void main(String[] args) {
        new InterfaceBMIcalculator();
    }
}

Below shows the result of the interface design that I have produced and I improved it further to increase its aesthetic power.

Screenshot (782)
Screenshot (784)
Screenshot (786)
bottom of page