0% found this document useful (0 votes)
8 views10 pages

Java & Operating System

The document provides an overview of programming concepts including tokens, identifiers, literals, data types, and escape sequences in Java. It includes examples of Java code for various operations such as calculating expressions, displaying formatted output, and computing interest. Additionally, it discusses operating systems, their functions, and types, along with a brief comparison of CUI and GUI.

Uploaded by

shubhamsinghkol
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views10 pages

Java & Operating System

The document provides an overview of programming concepts including tokens, identifiers, literals, data types, and escape sequences in Java. It includes examples of Java code for various operations such as calculating expressions, displaying formatted output, and computing interest. Additionally, it discusses operating systems, their functions, and types, along with a brief comparison of CUI and GUI.

Uploaded by

shubhamsinghkol
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

(15/04/2023- Class8-9:30 am to 11am + 11:30am to 1pm batch)

TOKEN
Smallest individual unit in a program
1. Identifier –which identify the naming rules and conventions for
variables, class, functions.
Rules:-
a) Not start by a digit
b) No special character except $ and _
c) No keywords
d) No space and it must be a meaningful name (convention)
e) That can be any length
2. Literals and corresponding data type
Integer byte 1 byte = 8 bits(0 to 7) -27 to 27-1 int x=0
Literals short 2 bytes=16 bits (0 to 15) -215 to 215-1 short x=0
int 4 bytes = 32 bits (0 to -231 to 231-1 int x=0
long 31) -263 to 263-1 long x=0
8 bytes = 64 bits (0 to long
63) x1=9831934306L
(more than 9 digit
take L)
Floating point float 4 byte= 32 bits (24bits + float x=0.0
literals – real double 8bits) float
No. 8 byte= 64 bits (48bits + x=0.5f(Compulsory)
Fractional 16bits) double x=0.0d
Form – 65.23
Exponential
Form –
652.3x10-1
652.3E-1
(before E the
part is called
mantissa and
after E a the
part is called
Exponent)
6.523 x 101
6.523E01
Character char 2 bytes = 16 bits 1 to 216 char ch =’\0’
Represent by
single quotes
String (non- String No. of Character x 2 String S=null
primitive) bytes String S=””
String
S=”Computer
Application Class
IX –APC@2023”
Boolean Boolean 1 bits true/false boolean x=false
Escape Sequence in Java
Non graphic characters in Java
\t, \n,\0, \\ , \”

class pqr
{
void main()
{
[Link](5+6/3*9+" "+5*6/3+5+3+(10-2));
// 5+2*9=23 (left of “”)
//10538 = (“Right of “”)
//2310538
[Link]("Name\tRoll\tClass\tSection");
[Link]("Ram\t10\tX\tD");
[Link]("Bikram Kar\nDishani Dutta\nIshika\nIshani");
[Link]("Bikram Kar\"Dishani\"Dutta\nIshika\nIshani");
}
}

My name is “Avirup”
[Link](“My name is \”Avirup\””);
What is OS?
As per book
Function of OS
8 to 9 points
Relationship of Hardware and Software

Youtube – Application Software


Windows - OS
RAM – Hardware

Face Book
Android -OS
RAM

CC1/CC2 –salt lake

Above part discussed in 9:30am/11:30am batch

Types of OS
What is booting
CUI Vs GUI

/*Write a program to calculate and display the value of the


// given expression:
(a2+b2)/(a-b),when a=20, b=15
*/
class q1ch4// must follow the rule of identifer
{
int a=20; int b=15;
void main()
{
[Link]("The answer is="+(a*a+b*b)/(a-b));

[Link]("Incredible" + "\n" + "world");


[Link]("Name\tRoll\tClass\tSection");
[Link]("Ram\t10\tX\tD");
[Link]("Bikram Kar"+"\n"+"Dishani
Dutta\nIshika\nIshani\n");
[Link]("Bikram
Kar\"Dishani\"Dutta\nIshika\nIshani");
[Link]("XYZ\"COMPUTER\" ");

}// end of main()


}// end of class
// program to print details of schhol in five lines

class Q2L

void main()

[Link]("Assembly of Angels");

[Link]("Barrackpore");

[Link]("ICSE Board");
[Link]("Up to 12");

[Link]("English Medium");

[Link]("@@@@@@@@@@@@@@@@@");

[Link]("Assembly of Angels\nBarrackpore\nICSE
Board\nUp to 12\nEnglish Medium\n");

// Write a program to accept Principal, Rate and Time.

// Calculate and display the interest accumulated for the

//first year, second year and the third year compound


annually.

// Sample Input:

/* Principal = 5,000, Rate = 10% per annum, Time = 3 years

Sample Output:

Interest for the first year: Rs. 500

Interest for the second year: Rs. 550

Interest for the third year: Rs. 605 */

class q3ch4

{
void main(double p, double r, double t)

double i1 = (p * r * t) / 100.0;

double amt = p + i1;

[Link]("Interest for the first year: " + i1);

double i2 = amt * r * t / 100.0;

amt = amt + i2;

[Link]("Interest for the second year: " + i2);

double i3 = amt * r * t / 100.0;

amt = amt + i3;

[Link]("Interest for the second year: " + i3);

class Q3to8L

void main()

{
int r=10;

int x=2060, y=599;

int sum=x+y;

int a=40; int b=85; int c=115;

int m=150; int n=200;

double avg=(a+b+c)/3.0;

int pro=m*n;

double area=22/7.0*r*r;

double cir=2*22/7.0*r;

double dis=192;

double t=3;

double s=dis/t;

[Link]("Sum="+sum+"Average="+avg+"Product=
"+pro+"\n"+"Area="+area+"Circum="+cir+"Speed="+s);

int A=10, B=20;

[Link](A+"before swap"+B);

A=A+B; //10+20=30

B=A-B;//30-20=10

A=A-B; //30-10= 20

[Link](A+"After swap"+B);//A=20 ,B=10


int temp=A;

A=B;

B=temp;

[Link](A+"After swap"+B); //A=10, B=20

/*

A=15 ,B=20

int temp=A; // temp=15 now A is empty

A=B;// A=20 (store the value of B into A)

B=temp;// (B=15. means the value of A already store

in to temp now store into B)

A=20 , B=15 */

/* Question 2

Write a program to calculate the gross salary of an


employee when

Basic Salary = Rs.8600

DA = 20% of Salary

HRA = 10% of Salary

CTA = 12% of the Salary.


Gross Salary = (Salary + DA + HRA + CTA)

Display the basic and gross salary. */

class Q2ch4

void main(double bs)

double DA=bs*20/100.0;

double HRA=bs*10/100.0;

double CTA=bs*12/100.0;

double GS=(bs+DA+HRA+CTA);

[Link]("Basic="+bs+"\t"+"Gross Salary="+GS);

/* A shopkeeper announces two successive discounts 20%


and 10% on purchasing

of goods on the marked price. Write a program to input


marked price.

Calculate and display the selling price of the article.*/


class Q4ch2

void main(double mp)

double p1dis=mp-(mp*20/100.0);

double p2dis= p1dis-(p1dis*10/100.0);

[Link](p2dis);

You might also like