Skip to main content

Featured

How to make a simple calculator with GUI in JAVA (using Netbeans)?

First of all create a new package , then create a simple class. Then create a new JFrame Form class. On the right side you will find every tool needed like buttons textfield radio buttons etc. We'll need the buttons and text field and a JLabel Drag and drop required buttons you want to appear on the calculator eg. 1,2,3,4,5,6,7,8,9,0,+,-,*,/,=,AC,OFF arrange them all then on double clicking any button you will enter the source code tab, for digits 0-9 you have to write this code:         String Number =answer.getText() +  one.getText();         answer.setText(Number); Here answer is the jTextFields variable name you can right click the text field and click change variable name. similarly you have to set the code for every digit then for operations you have to write the code: for "+" operation: firstnumber = Double.parseDouble(answer.getText());         jLabel1.setText(answer.getText()+"+"); ...

Make a program to calculate gpa per subject

We will make a program to calculate gpa of subject
you have to enter your marks out of 100


Heres the code.
and screenshots








#include <iostream>
using namespace std;
int main ()
{
 
 

 float marks;
 cout<<endl;

 

 cout<<" \n\n Enter your marks out of 100 \n\n";
 cout<<endl;
 cin>> marks;

 
  if(marks>=90)
  { 
   
   cout<<" \n Your grade is A+ \n and gpa is 4";
   
  }
  else if(marks>=85)
  {
   cout<<" \n Your grade is A \n and gpa is 3.7";
  }
  else if(marks>=80)
  {
   cout<<" \n Your grade is B+ \n and gpa is 3.3";
  }
  else if(marks>=75)
  {
   cout<<" \n Your grade is B+ \n and gpa is 3";
  }
  else if(marks>=70)
  {
   cout<<" \n Your grade is B+ \n and gpa is 2.7";
  }
  else if(marks>=65)
  {
   cout<<" \n Your grade is B \n and gpa is 2.3  ";
  }
  else if(marks>=60)
  {
  cout<<" \n Your grade is C \n and gpa is 2";
  }
  else if(marks>=55)
  {
  cout<<" \n Your grade is D \n and gpa is 1.7";
  }
  else if(marks>=50)
  {
  cout<<" \n Your grade is E \n and gpa is 1.3";
  }
  else if(marks<=49)
  {
   cout<<" \n Your grade is F You are failed";
  }

return 0;

}

 Thanks for visiting :)

Comments