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
Elena L [17]
3 years ago
7

Basic C++ For Loop I'm trying to learn. Replit tells me that the for in the forloop is an error, but I don't know what's wrong.

Can anyone help?

Engineering
1 answer:
STatiana [176]3 years ago
8 0

Answer:

  curly brackets are missing

Explanation:

The body of the main() function need to be enclosed in curly brackets. Try this:

int P = 3000;

int main( ) {

  for (int t = 0; t < 10; t++) {

     cout << P;

  }

}

You might be interested in
Line(s) indicates passing is allowed if there are no oncoming cars.
anygoal [31]
Broken yellow b/c you can’t pass on a double solid yellow
5 0
4 years ago
This assignment is designed to test your understanding of graphical user interface components and Event Driven programming in Ja
lys-0071 [83]

Answer:

Java program is given below

Explanation:

JavaPadGUI.java

package javapad.gui;

import java.awt.BorderLayout;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.awt.event.WindowAdapter;

import java.awt.event.WindowEvent;

import java.io.File;

import java.io.FileNotFoundException;

import java.io.PrintWriter;

import java.util.Scanner;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JPanel;

import javax.swing.JScrollPane;

import javax.swing.JTextArea;

public class JavaPadGUI extends JFrame implements ActionListener{

  //constants

  private static final String TITLE = "Macrosoft JavaPad XP";

  private static final String SLOGAN = "Macrosoft: Resistance is futile";

 

  //button names

  private static final String NEW = "New";

  private static final String LOAD = "Load";

  private static final String SAVE = "Save";

  private static final String QUIT = "Quit";

 

  private static final String FILENAME = "hardcode.txt";

  //messages

 

  private static final String QUIT_MSG = "Quitting, Save?";

  private static final String LOAD_ERR = "Could not access file " + FILENAME;

 

 

  //fields

  private JTextArea txtContent;

  private JButton butNew, butLoad, butSave, butQuit;

 

  public JavaPadGUI()

  {

      super(TITLE);

      createUI();

      setSize(new Dimension(400, 300));

      setDefaultCloseOperation(EXIT_ON_CLOSE);

         

  }

 

  private void createUI()

  {

      Container c = getContentPane();

      c.setLayout(new BorderLayout(30,30));

     

      //create the buttons panel

      JPanel butPanel = new JPanel();

      butPanel.add(butNew = new JButton(NEW));

      butPanel.add(butLoad = new JButton(LOAD));

      butPanel.add(butSave = new JButton(SAVE));

      butPanel.add(butQuit = new JButton(QUIT));

     

      //set command names for the buttons, these will be when button is clicked

      butNew.setActionCommand(NEW);

      butLoad.setActionCommand(LOAD);

      butSave.setActionCommand(SAVE);

      butQuit.setActionCommand(QUIT);

     

      JPanel sloganPanel = new JPanel();

      sloganPanel.add(new JLabel(SLOGAN));

     

      //create textarea with scrollbar

      txtContent = new JTextArea(15, 25);

      txtContent.setLineWrap(true);

         

      JScrollPane scroll = new JScrollPane(txtContent);

     

      //now add all components

      c.add(butPanel, BorderLayout.NORTH);

      c.add(scroll, BorderLayout.CENTER);

      c.add(sloganPanel, BorderLayout.SOUTH);

     

     

      //set the actionlistner to buttons to handle button click event

      butNew.addActionListener(this);

      butLoad.addActionListener(this);

      butSave.addActionListener(this);

      butQuit.addActionListener(this);

     

  }

  public void actionPerformed(ActionEvent e)

  {

      String cmd = e.getActionCommand();

      if(cmd.equals(NEW))

          txtContent.setText("");

      else if (cmd.equals(LOAD))

          load();

      else if(cmd.equals(SAVE))

          save();

      else if (cmd.equals(QUIT))

          quit();

  }

  private void quit()

  {

      int option = JOptionPane.showConfirmDialog(this, QUIT_MSG);

      if(option == JOptionPane.YES_OPTION)

      {

          save();

      }

     

      System.exit(0);

  }

 

  private void save()

  {

      try {

          PrintWriter w = new PrintWriter(new File(FILENAME));

          w.write(txtContent.getText());

          w.close();

      } catch (FileNotFoundException e) {

          JOptionPane.showMessageDialog(this,"I/O Error", LOAD_ERR, JOptionPane.ERROR_MESSAGE);

      }

             

  }

  private void load()

  {

      try {

          Scanner s = new Scanner(new File(FILENAME));

          String str = "";

          while(s.hasNextLine())

              str += s.nextLine();

          txtContent.setText(str);

          s.close();

      } catch (FileNotFoundException e) {

          JOptionPane.showMessageDialog(this, LOAD_ERR, "I/O Error",JOptionPane.ERROR_MESSAGE);

      }

     

  }

}

RunJavaPad.java

package javapad;

import javapad.gui.JavaPadGUI;

public class RunJavaPad {

  public static void main(String[] args) {

      JavaPadGUI gui = new JavaPadGUI();

      gui.setVisible(true);

  }

}

7 0
3 years ago
Consider a dip-coating process where a very long (assume infinitely long) wire(solid) with radius, ri, is being pulled verticall
Gekata [30.6K]

Answer:

See explaination and attachment.

Explanation:

Navier-Stokes equation is to momentum what the continuity equation is to conservation of mass. It simply enforces F=ma in an Eulerian frame.

The starting point of the Navier-Stokes equations is the equilibrium equation.

The first key step is to partition the stress in the equations into hydrostatic (pressure) and deviatoric constituents.

The second step is to relate the deviatoric stress to viscosity in the fluid.

The final step is to impose any special cases of interest, usually incompressibility.

Please kindly check attachment for step by step solution.

6 0
4 years ago
The voltage and current at the terminals of the circuit element in Fig. 1.5 are zero fort &lt; 0. Fort 2 0 they areV =75 ~75e-10
masya89 [10]

Answer:

maximum value of the power delivered to the circuit =3.75W

energy delivered to the element = 3750e^{ -IOOOt} - 7000e ^{-2OOOt} -3750

Explanation:

V =75 - 75e-1000t V

l = 50e -IOOOt mA

power = IV = 50 * 10^-3 e -IOOOt * (75 - 75e-1000t)

=50 * 10^-3 e -IOOOt *75 (1 - e-1000t)

=

maximum value of the power delivered to the circuit =3.75W

the total energy delivered to the element = \int\limits^t_0  {3.75(e^{ -IOOOt} - e ^{-2OOOt} )} , dx \\\\

3750e^{ -IOOOt} - 7000e ^{-2OOOt} -3750

5 0
3 years ago
An example of Ferrous alloy is Brass a)-True b)-False
djyliett [7]

Answer: False

Explanation: No, brass is not a ferrous alloy.  

      Ferrous alloys are those alloy which contain iron like cast iron, steel, strain-less steel, high carbon steel. Brass on the other hand does not contain any composition. of iron hence it can not be considered as a ferrous alloy. Brass comes under the category of non- ferrous made with a composition of copper and zinc, however their proportion is not strict and we can add other elements like aluminium or lead to alter its durability or corrosiveness.  

5 0
4 years ago
Other questions:
  • ¿Por qué creen que la Ingeniería Metalúrgica es una carrera estratégica para el desarrollo de nuestro país?
    9·1 answer
  • A gear motor can develop 2 hp when it turns at 450rpm. If the motor turns a solid shaft with a diameter of 1 in., determine the
    7·1 answer
  • Eutectic product in Fe-C system is called A. Pearlite B. Bainite C. Ledeburite D. Spheroidite
    13·1 answer
  • Describe three parts of a fluid power system and the roles played by each to make the device work.
    8·1 answer
  • Advantages of using metal
    7·1 answer
  • To remove a spark plug the technician would need a(n) ___socket​
    7·2 answers
  • Determine the reactor volume (assume a CSTR activated sludge aerobic reactor at steady state) required to treat 5 MGD of domesti
    5·1 answer
  • A 132mm diameter solid circular section​
    5·1 answer
  • Lance is the sitting judge in the local family court. What education might have been
    10·1 answer
  • The three construction crafts that require a MINIMUM of a 4-year college degree are
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!