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

Using netbeans write a code for java Use printf. Do not use JOptionPane. Note: I

ID: 673713 • Letter: U

Question

Using netbeans write a code for java

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;
        Double pounds;
        System.out.printf(" Kilograms Pounds ");
        while(kgs < 200){
            pounds=kgs*2.2;
            System.out.printf(" %3d %3f ",kgs,pounds);
            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