Identify the differences in the code samples and discuss it

Assignment Help Operating System
Reference no: EM13943182

Details: Coding style is a very important characteristic for those entering the technology field. Here are two sample 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: EM13943182

Questions Cloud

Provide a current example of a compelling news story : After studying the assigned reading 21st Century Communication: A Reference Handbook: Chapter 65: The Changing Nature of "News" considering the concepts of timeliness, proximity, unusualness, prominence, impact, conflict and human interest, provid..
Determine pounds of quicklime and soda ash : A lime-soda softening plant treats a flow of 150 MGD, and the water has 86mg/l Ca2+, 35 mg/L Mg2+, 299 mg/L HCO3- and 6mg/l CO2. The commercial grade of quicklime has a purity of 85% and the soda ash has a purity of 95%. Determine the pounds of qu..
Many projects use a resource that the company already owns : Many projects use a resource that the company already owns. When evaluating a capital budgeting decision, we generally include interest expense. Only include as incremental expenses in your capital budgeting analysis the additional overhead expenses ..
Determining the incremental earnings of a project : We begin the capital budgeting process by determining the incremental earnings of a project. The marginal corporate tax rate is the tax rate the firm will pay on an incremental dollar of pretax income. Investments in plant, property, and equipment ar..
Identify the differences in the code samples and discuss it : 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.
Aspects of the projects keeping in mind : What project management tools would you use to implement and monitor all aspects of the projects keeping in mind - Anti-discrimination
What is a durable power of attorney : What is a Durable Power of Attorney? Find an example of the basic terms and submit with your explanation.
What is the projects annual cash flow for year three : You must evaluate a proposal to buy a new milling machine. the base price is $108,000, and shipping and installation costs would add another $12,500. The machine falls into the MACRS 3-year class, and it would be sold after 3 years for $65,000. What ..
Environmental challenges in australia : Imagine you have the role of Administration Officer, Environmental Challenges Australia Ltd. You have been asked to plan, draft, review and write a final copy of fully blocked style letter to Southern Office Furniture Pty Ltd asking for their curr..

Reviews

Write a Review

Operating System Questions & Answers

  Protected information for both coppa and cipa

The Children's Online Privacy Protection Act (COPPA) and the Children's Internet Protection Act (CIPA) are both intended to provide protections for children accessing the Internet. However, they both have had some opposition. Question 1: Describe ..

  1 synchronization within monitors uses condition variables

1. synchronization within monitors uses condition variables and two special operation wait and signal. a more general

  Stateful inspection packet filtering routers

Name two benefits of Stateful Inspection Packet Filtering Routers. Name two benefits that firewalls add to a network

  Write down the reference string if page size is given

Consider following sequence of memory references from 460-byte program: 10, 11, 104, 170, 73, 309, 185, 245, 246, 434, 458, 364. Write down the reference string, assuming page size of 100 bytes.

  How the key is generated in derived aes algorithm.

What AES standard functions for key generation and encryption are similar in derived AES. How the key is generated in derived AES algorithm.

  Ext4 file systems on linux vs. ntfs file systems

List what characters are absolutely not allowed for ext4 file systems on Linux vs. NTFS file systems on Windows in a plain text document.

  Differences between a process and a program

During its lifetime a process goes through several different "states". Explain each state and what events cause the state transitions.

  Describe function of operating system

Determine the functions that an operating system provides to make a computer run. Describe why that is an important feature and what an OS requires to be aware of to provide that service.

  Explaining cpu midway through the disk-service routine

CPU with interrupt-driven I/O is busy servicing  disk request. While CPU is midway through the disk-service routine, another I/O interrupt occurs. What occurs next?

  What characteristics do mainframe operating systems have

What are the fundamental differences between Windows®, Mac OS®, UNIX, and Linux operating systems for personal computers? What unique characteristics do mainframe operating systems have?

  Finding the length of cable in the lan

Suppose that the smallest possible message is sixty-four bytes. If we use 10BaseT, how long is a sixty-four byte message?

  Why the lynx companys functional system has been successful

Consider the following scenario involving a functional system used by the Lynx Company. The Lynx Company uses a functional system for their sales system. Identify five reasons why the Lynx Company's functional system has been successful (be sure t..

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