Identify the differences in the code samples

Assignment Help Operating System
Reference no: EM1379724

Coding style is a very important part for those entering the technology field. Here are two model Java programs that do exactly the same thing according to the user. Please identify the differences in the code samples and discuss the style of each sample. Make sure to address readability as a characteristic and how it would influence an IT department's ability to maintain custom software for a corporation.

1. SAMPLE CODE A:

import java.util.Scanner;
public class DB2_SampleA{
public static void main(String args[]){
Scanner input = new Scanner(System.in);
int num1;
System.out.print("Enter first number: ");
num1 = input.nextInt();
int num2;
System.out.print("Enter second number: ");
num2 = input.nextInt();
if (num1>num2)
System.out.println("First number is bigger");
if (num1<num2)
System.out.println("Second number is bigger");
if (num1==num2)
System.out.println("Numbers are equal");
}}

2. SAMPLE CODE B:

// DB2_SampleB
// This program will get two numbers from the user
// and determine which is bigger or whether they are equal

import java.util.Scanner; // Scanner class used for getting user input

public class DB2_SampleB
{
// The manin method that begins execution of Java application
public static void main(String args[])
{
// variable declarations
int num1; // first number to compare
int num2; //second number to compare

// create Scanner to capture input from console
Scanner input = new Scanner(System.in);

// get user input, num1 and num2
System.out.print("Enter first number: ");
num1 = input.nextInt();
System.out.print("Enter second number: ");
num2 = input.nextInt();

// compare numbers and display results
if (num1 > num2)
System.out.println("First number is bigger");
if (num1 < num2)
System.out.println("Second number is bigger");
if (num1 == num2)
System.out.println("Numbers are equal");

Please identify the differences in the code samples and discuss the style of each sample. Make sure to address readability as a characteristic and how it would influence an IT department's ability to maintain custom software for a corporation.

Reference no: EM1379724

Questions Cloud

Why this will make company more competitive : A company well regarded in community it's located in also concerned with this built reputation, is thinking of outsourcing one of its product lines; this will make company more competitive also presumably allow firm to grow.
Discuss standout features of companies approaches : "Malcolm Baldrige National Quality Award" Please respond to following. Discuss standout features of companies' approaches to managing operations.
Discussing the social and legal requirements : Discussing the social and legal requirements when it comes to Global Sourcing, however, since we know that corporate policy will vary from company to company, what about the law?
Why would someone else not make those purchases : Why would someone else not make those purchases. How would you choose one outlet, brand or model over others? Would others make same choice in same way.
Identify the differences in the code samples : Coding style is a very important part for those entering the technology field. Here are two model Java programs that do exactly the same thing according to the user.
What two countries were embarking on a series of structural : What two countries were embarking on a series of structural social also economic reforms that were designed to completely alter its failed political also ideological history.
How you could use all four operant conditioning principles : Specifically define also n describe how you could use all four operant conditioning principles of Reinforcement theory to shift emphasis among firm's employees toward ethical behaviour also away from unethical behaviour.
What are those sources : James Dyson has begun experimenting with robotics also microchips to accomplish what objective.
Compare and contrast the following, in terms of cores : Compare and contrast the following, in terms of cores (or microprocessors), random access memory (RAM), disk storage, and networking capabilities. Supercomputers, Mainframe computers , Desktop, computers, Laptops, Handheld computers

Reviews

Write a Review

Operating System Questions & Answers

  What is cpu utilization for round-robin scheduler

when a process requests for I/O operations, it will suspend and another process will need to be selected for execution. What is the CPU utilization for a round-robin scheduler.

  Page fault with lru page replacement policy

Computer has 16 pages of virtual address space but only three physical pages frames. Initially physical memory is empty. Program references virtual pages in order 1,2,3,4,5,3,4,1,6,7,8,7,8,9,7,8,9,5,4,5,4,2 Which references a page fault with LRU ..

  Pros and cons of using embedded uid and pw

Think about an embedded user id and password which provides me access to a client/server environment. Discuss the pros and cons of using an embedded uid and pw?

  Determine the value of flags

Suppose if the last operation performed on a computer with an 8-bit word was an addition in which 2-operands were 00000010 and 00000011, determine the value of the following flags?

  Requirement for routers to support ipv4 and 6 protocol stack

The answer describes the requirement for routers to support both IPv4 and IPv6 protocol stacks and describes the several types of connections a dual stack router can support, and why such connections are necessary.

  Solving passwords problems

As we all know about problems with people and passwords and how technology can mitigate some of them. What types of problems do you assume implementing these technologies for people might cause?

  Rights to privacy

Determine what rights to privacy do people have when using the Internet at home? Are their privacy rights limited? Do those same rights and limits exist at work? Describe your view.

  Find the sizes of the tag, block and word fields

Assume that a computer using direct mapped cache has 2^24 words of main memory and a cache of sixty-four blocks, where each cache block contains sixteen words.

  Question about sarbanes oxley act in the us

Sarbanes-Oxley Act in the United States has greatly increased the compliance obligations of publicly traded corporations.

  Computing total pay and net pay

Construct a Unix shell script to input number of hours worked and pay rate and compute the total pay, then the social security amount, then the net pay.

  Calculate effective access time of system

Assuming fetches to main memory are started in parallel with look-ups in cache, calculate the effective (average) access time of this system.

  Solving hub issue

Linda has been asked the job of connecting 5-computers to a network. The room holding 5-computers has 3-network ports that connect to a hub in an electrical closet down the hallway.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd