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

  Switching elements in nxn banyan network

A stage of n x n banyan network consists of (n/2) 2x2 switching elements. 1st stage directs packets to the correct half of the network.

  Dealing with internet security and privacy

A procedure is said to be I/O bound if it needs a lot of I/O operations, whereas a procedure that consists of mostly computations within the CPU/memory system is said to be compute bound.

  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.

  Encoding the data using the generator polynomial

Encode the data bit sequence 10011011100 using the generator polynomial and provide the code word.

  Analyse the different methods for collecting data

Analyse the different methods for collecting data Explain by taking examples 3 types of Sampling techniques.

  Question about information security

Discover an article about information security. Give an introduction, and select various aspects of the article or Web site.

  Hardware and software requirements for ehr systems

Recognize the hardware and software requirements to connect in dissimilar EHR systems. Discuss the solutions that have been suggested through the Federal Government and private organizations.

  Clock drift results in error

Think about a frame being sent using synchronous transmission. Suppose that samples are taken at the middle of the bit period and that the clocks are synchronized at the starting of each frame.

  Steps add to the check list

According to your personal experience, what steps would you add to the check list and determine what steps would you leave out?

  Find total memory bytes stored in the cache

Following, a byte addressable main memory of 2^16 bytes and block size of eight bytes, using direct mapped cache consisting of thirty-two lines.

  Header fields in the ipv4 and ipv6 protocols

Compare the header fields in the IPv4 and IPv6 protocols. Explain strategies for converting IPv4 packets to IPv6 packets in a hybrid IP network.

  What is life cycle costing

What is Life Cycle Costing. Describe briefly the methodology for Life Cycle Costing. What are the criteria to consider when a procurement officer is faced with the decision of procuring a used equipment instead of a new one.

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