Preview

Sheet Java Study Guide

Good Essays
Open Document
Open Document
576 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Sheet Java Study Guide
(Eng. Hayam Reda Seireg)

Sheet Java
1. Write a program to compute the area and circumference of a rectangle 3 inche wide by 5 inches long.
What changes must be made to the program so it works for a rectangle 6.8 inches wide by 2.3 inches long? public class AreaOfRectangle {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here int width=3,height=5;
// double width=6.8,height=2.3; int area,circumference;
// double area,circumference; area = width * height; circumference = 2 *( width + height);
System.out.println("The area of rectangle is "+ area+" the circumference is "+ circumference);
}
}

2- Write a program to print your name, and date of birth?
…show more content…
package sum.of.the.array; import java.util.Scanner;
/**
*
* @author hayam
*/
public class SumOfTheArray {
/**
* @param args the command line arguments
1

*/ public static void main(String[] args) {
// TODO code application logic here int size,sum=0;
Scanner scan = new Scanner (System.in);
System.out.println("Enter the size of the array "); size=scan.nextInt(); int [] x = new int [size]; for( int i=0;i=81 || x==90)
System.out.println("B");
else if (x>=71 || x==80)
…show more content…
package count.positive; import java.util.Scanner;
/**
*
* @author hayam
*/
public class CountPositive {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here

14

int size, count=0,n=0;
Scanner scan = new Scanner (System.in);
System.out.println("Enter the size of the array "); size= scan.nextInt(); int [] x = new int [size]; for( int i=0;i 0)
System.out.println("The positive value is " + ++ count); else if

You May Also Find These Documents Helpful

  • Satisfactory Essays

    = z) return true; else return false; } Problem 5 a. Output: 720 b. Output: 0 c. Output: 71 d. Output: 362880 Problem 6 a. Output: “Take Programming I.” b. Output:…

    • 188 Words
    • 1 Page
    Satisfactory Essays
  • Better Essays

    References: Schmalleger, F., Hall, D. E., & Dolatowski, J. J. (2010). Criminal Law Today: An introduction with…

    • 1042 Words
    • 5 Pages
    Better Essays
  • Satisfactory Essays

    Nt1310 Assignment 1

    • 407 Words
    • 2 Pages

    II. Analysis. The intent for this program is to calculate the square footage of a house with no more than four rooms that are rectangular in shape. In order to do this we will identify each room, input the length (l) and width (w) of each room, multiply the l x w of each room to get the square foot, and add the sum of each room to secure the total square footage of the house.…

    • 407 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Match the Definitions on the left to the correct Terms on the right by entering the correct corresponding alphabetical letter next to the numbers in the first column. Not all terms will be used.…

    • 975 Words
    • 4 Pages
    Good Essays
  • Good Essays

    Nt1330 Unit 1 Assignment 1

    • 4614 Words
    • 19 Pages

    A ______ is rectangular area that can contain a document, program, or message option1 A __________ contains icon buttons that access frequently used commands A __________ provides access to features of the program A built-in tool that performs calculations automatically is a(an) A collection of related data that has been entered into a computer is called a A collection of separate software applications that are sold as a group, like Microsoft Office, is called a(n) A database sort directs the software to find and display one or more records option2 option1 option3 option3 option4 option2…

    • 4614 Words
    • 19 Pages
    Good Essays
  • Satisfactory Essays

    You also possible to search a book or topic on the digital platform. You can access ebooks on our…

    • 1090 Words
    • 5 Pages
    Satisfactory Essays
  • Powerful Essays

    * Use a graphical interface to allow a user to input a principle amount, interest rate…

    • 763 Words
    • 4 Pages
    Powerful Essays
  • Satisfactory Essays

    hardy

    • 798 Words
    • 4 Pages

    Directions: Work out the following problems on a separate piece of paper. Show ALL work and circle your answers.…

    • 798 Words
    • 4 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Variable and Meal Price

    • 1236 Words
    • 9 Pages

    10.) Design a subroutine called timesTen. The subroutine should accept an integer argument. When the subroutine is called, it should display the product of its argument multiplied by 10.…

    • 1236 Words
    • 9 Pages
    Satisfactory Essays
  • Satisfactory Essays

    mr angola

    • 329 Words
    • 2 Pages

    That accepts the circle radius from a user, compute area and circumference. Formula Area= π r², circumference = 2* π r.…

    • 329 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    For number 8, take your time and write a complete solution in C++ that can be run and played with…

    • 881 Words
    • 4 Pages
    Good Essays
  • Good Essays

    c Codes

    • 14476 Words
    • 58 Pages

    Find Area and perimeter of circle in c code. This c program makes a contrasting concept that how a return statement can return more than one value. Usually in C programming we make a call by value. This means that in general you cannot alter the actual arguments. But if desired, it can always be achieved through a call by reference. Using a call by reference intelligently we can make a function return more than one value at a time, which is not possible ordinarily. This is shown in the c program find area and perimeter of circle given below.…

    • 14476 Words
    • 58 Pages
    Good Essays
  • Good Essays

    Java Iq Test Program

    • 2251 Words
    • 10 Pages

    System.out.println("\nThere Are Seven Seniors On The Road\nEach One Having The Seven Crutches.\nHow Many Crutches Are At All?");…

    • 2251 Words
    • 10 Pages
    Good Essays
  • Satisfactory Essays

    1. Design an algorithm that prompts the user to enter his or her height and stores the users input in a variable named height.…

    • 414 Words
    • 4 Pages
    Satisfactory Essays
  • Good Essays

    Java Docs

    • 20537 Words
    • 83 Pages

    Java is an object-oriented programming language developed by Sun Microsystems, and modeled on C++, the Java language was designed to be small, simple, and portable across platforms and operating systems, both at the source and at the binary level, which means that Java programs (applets and applications) can run on any machine that has the Java virtual machine installed One might be surprised to learn that Java did not come into being because of Internet or World Wide Web (WWW), although it was WWW which propelled into java what it is as a language today and a de-facto standard for Server Side Softwares. Because of the similarities between C++ and Java, it is tempting to think of Java as the “Internet version of C++”, but it would be a big mistake since Java has practical and philosophical difference with C++. The history of java goes back to 1991, when a group of Sun Engineers led by Mr. Patrick Naughton and James Gosling wanted to design a small computer language that was to be used for consumer and electronic devices like Remote Controls, TV Switchboxes etc. Now since these devices were manufactured by different manufacturers who may choose different CPUs (Central Processing Units), the program should not be tied down to any single architecture. The project was code named “Green”. The languages was then called as Oak and since Oak was already an existing computer languages, it was code named as JAVA. But unfortunately, Sun did not get the project for which they were bidding and it was in 1994 with the advent of the WWW and browsers, java was propelled back in to the main stream. The JAVA as a language was reveled to the world in the Sun world 1995 conference and from there onwards different versions have come out with all the latest technologies being incorporated. The different versions are being dealt with separately in the coming modules. Java was basically invented as a platform independent software to be run on…

    • 20537 Words
    • 83 Pages
    Good Essays