OOP Lab
OOP Lab
package lab.pkg.menu;
public mymenu() {
initComponents();
@SuppressWarnings("unchecked")
jCheckBoxMenuItem1.setSelected(true);
jCheckBoxMenuItem1.setText("jCheckBoxMenuItem1");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
File.setText("File");
Exit.setText("Login");
Exit.addActionListener(new java.awt.event.ActionListener() {
ExitActionPerformed(evt);
});
File.add(Exit);
File.add(jSeparator1);
jMenuItem2.setText("Exit");
File.add(jMenuItem2);
jMenuBar1.add(File);
Edit.setText("Edit");
jMenuBar1.add(Edit);
Help.setText("help");
jMenuBar1.add(Help);
setJMenuBar(jMenuBar1);
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 736, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
);
pack();
}// </editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new mymenu().setVisible(true);
});
Log in form
package lab.pkg.menu;
import javax.swing.JOptionPane;
/**
* @author HP
*/
/**
*/
public LoginForm() {
initComponents();
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel2.setText("USER ID");
jLabel3.setText("Password:");
btnLogin.setText("Login");
btnLogin.addActionListener(new java.awt.event.ActionListener() {
btnLoginActionPerformed(evt);
});
btnExit.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
btnExit.setText("Exit");
btnExit.addActionListener(new java.awt.event.ActionListener() {
btnExitActionPerformed(evt);
});
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(btnLogin)
.addComponent(btnExit))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel2)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtUserID))))
.addContainerGap(148, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtUserID, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 119,
Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnLogin)
.addComponent(btnExit))
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>
#include<iostream>
int geardown,gearup,speed;
Bicycle()
B.speed=30 ;
B.geardown=B.speed-1;
B.gearup=B.speed+2;
}
Bicycle()
A.speed=20;
A.geardown=A.speed-1;
A.gearup=A.speed+2;
void display()
cout<<"For B Cycle:speed:"<<B.speed<<endl;
cout<<"After Break:speed:"<<B.geardown<<endl;
cout<<"After Speedup:speed:"<<B.gearup<<endl;
cout<<"For A Cycle:speed:"<<A.speed<<endl;
cout<<"After Break:speed:"<<A.geardown<<endl;
cout<<"After Speedup:speed:"<<A.gearup<<endl;
void displayNumber()
};
int main()
Bicycle A,B;
display();
displayNumber();
return 0;