Preview

Program Lovecs.Java

Better Essays
Open Document
Open Document
422 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Program Lovecs.Java
import java.util.Scanner; public class LoveCS
{
public static void main(String[] args) { Scanner scan=new Scanner(System.in); System.out.println("Enter how many times you wish the message to be printed."); int limit = 0; limit=scan.nextInt(); int sum=0; int count=1; while (count <=limit) { System.out.println(count+" I love Computer Science!!"); sum+=count; count++; } System.out.println("Printed this message " + limit + " times."); System.out.println("The sum of the numbers from 1 to "+limit+" is "+sum); }
}

import java.util.Scanner; public class PowersOf2
{
public static void main(String[]args)
{
int valuePowersOf2; int nextPowersOf2 =1; int exponent= 0; int count=0;

Scanner scan = new Scanner(System.in);

System.out.println("Enter A Number."); valuePowersOf2=scan.nextInt(); System.out.println(" First 8 "+valuePowersOf2+" powers of 2"); while(exponent<valuePowersOf2) {
System.out.println("2 ^ "+exponent+" = "+nextPowersOf2); while(count<=exponent) { nextPowersOf2*=2; count++;
}
exponent++;
}
}
}

// **********************************************************
// Temps.java
//
// This program reads in a sequence of hourly temperature
// readings (beginning with midnight) and prints the maximum
// temperature (along with the hour, on a 24-hour clock, it
// occurred) and the minimum temperature (along with the hour
// it occurred).
// **********************************************************

import java.util.Scanner;

public class Temps
{
//----------------------------------------------------
// Reads in a sequence of temperatures and finds the
// maximum and minimum read in.
//----------------------------------------------------
public static void main (String[] args)
{
final int HOURS_PER_DAY = 6;

int temp; //a temperature reading int maxTemp = -1000; //maximum temperature int miniTemp = 1000; //minimum

You May Also Find These Documents Helpful

  • Satisfactory Essays

    NT1210 Lab 1

    • 473 Words
    • 3 Pages

    (1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (1 * 2^0) = 8 + 0 + 2 + 1 = 11…

    • 473 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    cout << "You are in factorial program of C++. Please enter a +ve integer:- ";…

    • 426 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    jdsdkldwnls

    • 1012 Words
    • 3 Pages

    Ambrose Weeres was born and raised in Minnesota, the land of 10,000 lakes, and grew to become a farmer who wanted a more sturdy boat. With some experimenting, the pontoon was born, calling the first prototype The Empress. Ambrose made more and generously sold them throughout the area, but the small shop Ambrose worked in was not spacious enough for the large number of orders coming in, so he opened the Weeres Pontoon Boat Company in 1952. Although the beginning was hard, Ambrose went on to also create the first water bike, or paddle bike, and the idea of the pontoon inspired the idea of military bridges. Even after Ambrose retired and put his business into new hands, Weeres Pontoon Co. has sold over 30,000 pontoons today for fun and leisure out on the lake.…

    • 1012 Words
    • 3 Pages
    Good Essays
  • Good Essays

    This memo serves as a target plan, targeting new customers to Love Craft Incorporation. Love Craft Incorporation served customers for the last 30 years, majority of our customers is white middle age straight males/survivalist. As a result of flooding that occurs our customer is dying affecting our sales for the worst. It is time that Love Craft Incorporation creates a demographic, plan on ways to target new customers. Below are some suggestions:…

    • 272 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    Prestige Telephone

    • 474 Words
    • 2 Pages

    Prestige Data Services is a subsidiary of Prestige Telephone Company, a public utility. They are a computer data service company that does data processing for the parent company in order to sell computer services. The company was opened in order to bring in additional revenue in order to offset increases in telephone rate increases. Throughout the three years of being in operation the subsidiary has been unprofitable.…

    • 474 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    5. Which of the following is a collection of programs rather than a single program?…

    • 990 Words
    • 4 Pages
    Good Essays
  • Good Essays

    Program

    • 314 Words
    • 2 Pages

    or comparison purposes we also ran a triangular distribution to compensate for the lack of symmetry around the expected mean, but the results were broadly similar so we will discuss the results based on the truncated normal distribution.…

    • 314 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    IF YOU HAVE LETTERHEAD, Begin with the date. IF YOU DO NOT HAVE LETTERHEAD, begin with your return ADDRESS and date…

    • 753 Words
    • 4 Pages
    Satisfactory Essays
  • Good Essays

    import java.util. *; class LRU { static int nof,nop,i,index,m,frames[]=new int[100],fs[]=new int [100],n,miss=0,hit=0,l=0,flag1,flag2; public static void main(String args[]) { Scanner s=new Scanner(System.in); System.out.println("Enter the number of frames : "); nof=s.nextInt(); for(i=0;i<nof;i++) { frames[i]=-1; fs[i]=0; } System.out.println("Enter the number of pages : "); nop=s.nextInt();; int pages[]=new int[10]; System.out.println("Enter the pages : "); for(i=0;i<nop;i++) { pages[i]=s.nextInt();; } while(l<nop) { flag1=0;flag2=0; for(int k=0;k<nof;k++) { if(pages[l]==frames[k]) { hit++; flag1=1; flag2=1; break; } } if(flag1==0) { for(i=0;i<nof;i++) { if(frames[i]==-1) { frames[i]=pages[l]; miss++; flag2=1; break; } } } if(flag2==0) { for(i=0;i<nof;i++) fs[i]=0; for(m=l-1,n=1;n<nof;n++,m--) { for(i=0;i<nof;i++) { if(frames[i]==pages[m]) fs[i]=1; } } for(i=0;i<nof;i++) { if(fs[i]==0) index= i; } frames[index]=pages[l]; miss++; } l=l+1; display(); } } static void display() { for(i=0;i<nof;i++) { System.out.println("\n"+frames[i]); } System.out.println("\nMiss : "+miss+"\n\n\n"); } } /* OUTPUT D:\SECMPN 60>javac LRU.java D:\SECMPN 60>java LRU Enter the number of frames : 3 Enter the number of pages : 7 Enter the pages : 1 2 4 1 3 5 6 1 -1 -1 Miss : 1 1 2 -1 Miss : 2 1 2 4 Miss : 3 1 2 4 Miss : 3 1 3 4 Miss : 4 1 3 5 Miss : 5 6 3 5 Miss :…

    • 303 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    Whats Love

    • 640 Words
    • 3 Pages

    April to September: every day at 10.45 a.m., 11.45 a.m., 1.30 p.m., 2.30 p.m., 3.30 p.m., 4.30 p.m. and 5.30 p.m.…

    • 640 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Write a program to add of number in c programming. The output of the program should be like the figure below:…

    • 295 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    What is Love

    • 624 Words
    • 2 Pages

    Love is one of the greatest gifts that were given to mankind. Love is a word whose definition is as broad yet it’s understood. As simple as the word Love may seem; to define it may be one of the most difficult things to do. People express Love differently as we seen in the four speeches from Phaedrus, Pausanius, Eryximachus and Aristphanes.…

    • 624 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    Java

    • 1218 Words
    • 5 Pages

    Any program you execute .e.g., a calculator, will be loaded first into RAM, then when the CPU is ready to execute, instructions will be transferred part by part from RAM into the CPU. The CPU is divided into Logic Unit – to deal with general execution (in and out) and Arithmetic Logic Unit – to deal with instruction related to mathematical calculation. The CPU also has a set of memory/cache hierarchy usually referred to as register, L1 and L2. From programmer point of view, the details of CPU architecture and the memory and how they work are not important as long as a program written execute well without any errors. .…

    • 1218 Words
    • 5 Pages
    Satisfactory Essays
  • Powerful Essays

    Netbeans

    • 2569 Words
    • 11 Pages

    What Is a Rich Client? In a client server architecture the term rich client is used for clients where the data processing occurs mainly on the client side. The client also provides the graphical user interface (GUI). Often rich clients are applications that are extendable via plug-ins and modules. In this way, rich clients are able to solve more than one problem. Rich clients are typically developed on top of a framework. A framework offers a basic starting point on top of which the user can assemble logically related parts of the application, which are called modules. An overview of the characteristics of a rich client: ✔ Flexible and modular application architecture ✔ Platform independence ✔ Adaptability to the end user ✔ Ability to work online as well as offline ✔ Simplified distribution to the end user ✔ Simplified updating of the client What Is a Rich Client Platform? A rich client platform is an application life cycle environment, a basis for desktop applications. Most desktop applications have similar features, such as ✔ menus ✔ Toolbars ✔ status bar ✔ progress visualizations ✔ data display ✔ customization setting ✔ Saving and loading user-specific data and configurations ✔ Splash screens ✔ about boxes ✔ internationalization ✔ help systems etc ….... The most important aspect of a rich client platform is its architecture. Applications based on rich client platforms are written in the form of modules , within which logically coherent parts of an application are isolated . A rich client platform also frees the developer from being concerned with tasks that have little to do with the application’s business logic. Advantages of a Rich Client Platform ✔ ✔ Modularity :- provides high degree of robustness and end user value Reduction of Development Time →Through the re-usability of many predefined components, developers are able to concentrate very closely on the business logic of the application in question. →It provides a multitude of application programming…

    • 2569 Words
    • 11 Pages
    Powerful Essays
  • Powerful Essays

    Java

    • 5383 Words
    • 22 Pages

    Building applications for the enterprise has always been challenging. Some factors that contribute to this challenge and complexity are:…

    • 5383 Words
    • 22 Pages
    Powerful Essays