1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
bazaltina [42]
2 years ago
13

Wap in java to complete the following (16*1) +(14*2) +(12*3) +(10*4) +(8*5) +(6*6) +(4*7)​

Computers and Technology
1 answer:
vladimir1956 [14]2 years ago
3 0

Answer:

It goes like:

public class Program

{

public static void main(String[] args)

{

int j=18;

int sum=0;

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

{

sum=sum+(i*(j-2));

j=j-2;

}

System.out.println(sum);

}

}

Explanation:

<u>Variables used: </u>

j : controls the first number in product and decreases by 2 each time the loop runs.

sum: saves the values of addition as the loop runs.

You might be interested in
Import java.awt.GridLayout;
Vikki [24]

Answer:

public class ConversionCalculator extends JFrame {

  private JLabel inch_Label, meter_Label, cm_Label, yard_Label;

  private JButton clear, calculate, exit;

  private JTextField inch_tf, cm_tf, meters_tf, yards_tf;

 

  public ConversionCalculator()

  {

     

      exitButtonHandler exitB;

      clearButtonHandler clearB;

      calcButtonHandler calcB;

     

      setTitle("Conversion Calculator");

      setSize(600,200);

      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

     

      //The first layout we use will be 1 row with three columns

      setLayout(new GridLayout(1,3));

     

      //initialize all the components

      inch_Label = new JLabel("Inches");

      meter_Label = new JLabel("Meters");

      cm_Label = new JLabel("Centimeters");

      yard_Label = new JLabel("Yards");

      clear = new JButton("Clear");

      calculate = new JButton("Calculate");

      exit = new JButton("Exit");

      inch_tf = new JTextField("0.00");

      cm_tf = new JTextField("0.00");

      meters_tf = new JTextField("0.00");

      yards_tf = new JTextField("0.00");

 

      JPanel panel1 = new JPanel();

      panel1.setLayout(new GridLayout(2,2));

      JPanel panel2 = new JPanel();

      panel2.setLayout(new GridLayout(2,2));

      JPanel panel3 = new JPanel();

      panel3.setLayout(new GridLayout(3,1));

      panel1.add(cm_Label);

      panel1.add(cm_tf);

      panel1.add(meter_Label);

      panel1.add(meters_tf);

     

      panel2.add(inch_Label);

      panel2.add(inch_tf);

      panel2.add(yard_Label);

      panel2.add(yards_tf);

     

      panel3.add(clear);

      panel3.add(calculate);

      panel3.add(exit);

     

      add(panel1);

      add(panel2);

      add(panel3);

     

     

      exitB = new exitButtonHandler();

      exit.addActionListener(exitB);

     

      clearB = new clearButtonHandler();

      clear.addActionListener(clearB);

     

      calcB = new calcButtonHandler();

      calculate.addActionListener(calcB);

     

      setVisible(true);

  }

 

  //public static void main(String[] args)

     // {

       // new ConversionCalculator();

      //}

 

  private class exitButtonHandler implements ActionListener

  {

      public void actionPerformed(ActionEvent e)

      {

          //exits program

          System.exit(0);

      }

  }

 

  private class clearButtonHandler implements ActionListener

  {

      public void actionPerformed(ActionEvent e)

      {

          //clear button sets all text fields to 0

          inch_tf.setText("0.00");

          meters_tf.setText("0.00");

          yards_tf.setText("0.00");

          cm_tf.setText("0.00");

      }

  }

 

  private class calcButtonHandler implements ActionListener

  {

      public void actionPerformed(ActionEvent e)

      {

          double inches, yards, meters, cms;

          DecimalFormat df = new DecimalFormat("0.00");

         

          //parse strings in textbox into doubles

          inches = Double.parseDouble(inch_tf.getText());

          yards = Double.parseDouble(yards_tf.getText());

          meters = Double.parseDouble(meters_tf.getText());

          cms = Double.parseDouble(cm_tf.getText());

         

          //we check which value has been tampered with and base our conversion off this

          //because of this it is important that the user clears, or else it will do inch conversion

          if(inches != 0.00)

          {

              cms = inches * 2.54;

              meters = cms / 100;

              yards = inches / 36;

             

              cm_tf.setText(df.format(cms));

              meters_tf.setText(df.format(meters));

              yards_tf.setText(df.format(yards));

             

          }

          else if(yards != 0.00)

          {

              inches = yards / 36;

              cms = inches * 2.54;

              meters = cms / 100;

             

              cm_tf.setText(df.format(cms));

              meters_tf.setText(df.format(meters));

              inch_tf.setText(df.format(inches));

          }

          else if(meters != 0.00)

          {

              cms = meters * 100;

              inches = cms / 2.54;

              yards = inches / 36;

             

              cm_tf.setText(df.format(cms));

              inch_tf.setText(df.format(inches));

              yards_tf.setText(df.format(yards));

          }

          else if(cms != 0.00)

          {

              inches = cms / 2.54;

              yards = inches / 36;

              meters = cms / 100;

             

              meters_tf.setText(df.format(meters));

              inch_tf.setText(df.format(inches));

              yards_tf.setText(df.format(yards));

          }

      }

  }

}

Explanation:

  • Inside the action performed method, pass the strings in text box.
  • check if the value has been modified then do the relevant conversions inside the conditional statement.
  • When the user clears, it will not do to the inch conversion.
8 0
2 years ago
Select the correct answer from each drop-down menu. Which IF formulas are valid? _____ and _____ are valid IF formulas.
Lyrx [107]

Answer:

=IF(D3>50; E3; F3) AND =IF(A1>60;"Pass";"Fail")

Explanation:

An IF structure is built following this pattern:

IF(TEST;IFTRUE;IFFALSE)

These are the only options in the given drop-down menus what comply with this pattern.  All others are not following this pattern.

The computer will do the test and if the result is true will apply the IFTRUE value, otherwise will apply the IFFALSE value.

4 0
3 years ago
To run a PHP application that has been deployed on your own computer you can enter a URL in the address bar of your browser that
svet-max [94.6K]

Answer:

You can enter a URL that (B) Uses localhost as the domain name

Explanation:

Localhost refers to your computer or the computer that is currently in use.

To run a PHP application that is deployed on your computer, the localhost (which has an IP address of 127.0.0.1) is used.

The IP address is called a "loopback" address because all data sent or received revolve around the local computer.

8 0
3 years ago
When your purchases are swiped over the bar-code reader at the point-of-sale terminals at Wal-Mart, a _____ records the data.
nydimaria [60]

Answer: Transaction processing system

Explanation:

A transaction processing system basically records all the data in the system. It is the set of data that basically monitor all the transaction process in the system. It basically perform various transaction oriented applications in the system.

It also allow time delay in the system when the item is supposed to being sold to the actually selling of the item. There are basically various types of transaction processing system arr payroll, account payable and the inventory control.

4 0
3 years ago
What is a "telescreen"? How is it different from the televisions we know? Is it possible to make a television that could see and
mars1129 [50]

Answer:

  1. Telescreens are devices that operate as televisions, security cameras, and microphones.
  2. A television is an electronic communication medium that allows the transmission of real-time visual images, and often sound while a telescreen is a television and security camera-like device used to keep things or people under constant surveillance, thus eliminating the chance of secret conspiracies.
  3. It could be employed in secretly investigating criminals and terrorists.
  4. It could also play a major role in politics by investigating suspicious government officials and those that plan Ill towards a nation.
  5. It would definitely be a great idea to install one of such.

Explanation:

8 0
2 years ago
Other questions:
  • 4. An outline is most like which of the following? (1 point)
    14·1 answer
  • What part of the communication feedback loop results in unclear communication?
    13·1 answer
  • Each object that is created from a class is called a(n) ____________ of the class.
    5·2 answers
  • A web page typically contains ________, which contains the formatting instructions for displaying the web page.
    7·1 answer
  • What in the LAN for a small office, some user devices connect to the LAN using a cable, while others connect using wireless tech
    14·1 answer
  • What is the alogarithm for solving the perimeter of a triangle
    11·1 answer
  • BRAINLIEST BRAINLIEST BRAINLIEST BRAINLIEST BRAINLIEST BRAINLIEST BRAINLIEST BRAINLIEST BRAINLIEST BRAINLIEST BRAINLIEST BRAINLI
    6·2 answers
  • Universal containers set the organization-wide defaults for cases to private. When a case is escalated, case ownership changes t
    13·1 answer
  • HELP MEEE PLEASE!!!
    11·1 answer
  • If 200.123.4.6 is a classful internet protocol (ip) address, what class is it in?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!