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

  Implementation of algorithms for process management

The Shortest Job Next (SJN) algorithm queues processes in a way that the ones that use the shortest CPU cycle will be selected for running rst.

  Develop a user mode command interpreter

Develop a user mode command interpreter which support list-short.

  Memory allocation in operating system

Analysis and implementation of algorithms for memory allocation in operating system, Explain First- t and best- t methods are used in memory allocation in operating systems.

  Stand alone child process

Forking the child process

  Write a multi-threaded program

Write a multi-threaded program to solve producer and consumer problem

  Marginal and average cost curves

n a competitive market place (pure competition) is it possible to continually sell your product at a price above the average cost of production.

  Simulating operating systems scheduling

Simulate the long-term scheduler, the short-term scheduler and the I/O scheduler of the computer using the First-Come-First-Serve algorithm.

  Issues with trusted platform module

Research paper discussing the issues with Trusted Platform Module (TPM)

  Threads

Explain a complication that concurrent processing adds to an operating system.

  Design and programming

Use the semaphore methods to control the concurrency of the solution

  Virtual machines

Virtual machines supported by a host operating system

  Discuss an application that benefits barrier synchronization

Discuss an application that would benefit from the use of barrier synchronization

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