Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using netbeans write a code: Use printf. Do not use JOptionPane. Note: In format

ID: 673716 • Letter: U

Question

Using netbeans write a code:

Use printf. Do not use JOptionPane.

Note: In formatted printing
is TAB
is LINEFEED

(Conversion of kilograms to pounds) Write a program that displays the following table (note 1 kilogram is 2.2 pounds)

Kilograms                Pounds
1                                2.2
3                                6.6

...

197                       433.4
199                       437.8

Hint: The following code will print out odd integers from 1 to 99:

public class PrintOdds {
    public static void main(String[] args){
        int kgs=1;
        while(kgs < 100){
            System.out.printf(" %3d ",kgs);
            kgs+=2;
        }
    }
    

Explanation / Answer

public class PrintOdds {

public static void main(String[] args)
{   
int Kgs=1;
System.out.println("kilograms | pounds");
System.out.println("--------+-----------");
while(Kgs<100)
{

System.out.printf(" %3d ",kgs);   
Kgs+=2;
  
}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote