Computes the square root of the sum of num1 and num2

Assignment Help C/C++ Programming
Reference no: EM132088629

Part 1: Written Exercises

Note: The answers to the following questions should be typed in the block of comments in the Assignemnt3.java file. Please make sure they're commented out. Type them neatly and make them easy to read for the graders.

Exercise1: What output is produced by the following code fragment?

String m1, m2, m3;

m1 = "Java Programming";

m2 = m1.toLowerCase( );

m3 = m1 + " " + m2;

System.out.println(m3.replace('a','o'));

Exercise2: Write an assignment statement that computes the square root of the sum of num1 and num2 and assigns the result to num3.

Exercise3: What output is produced by the following code fragment?

int num = 57, max = 35;

if (num >= max*2)

System.out.println("orange");

System.out.println("lemon");

System.out.println("apple");

Part 2: Programming

Write a complete Java program in a source file to be named Assignment3.java.

The program should ask a user to enter two strings.
First, the program prompts:

Please enter a string.

The program should read in the string a user enters, and prompts:

Please enter another string.

The program reads in the string and performs the following:

checks if each string's length is odd or even.

checks if two strings are same or different.

checks which string is lexically larger, or they are same.

prints out the first character (index 0) of each string

prints out a new string consisting of the first string concatenated (appended) with the second string.

prints out two strings using upper case letters.

Here is the output your program should produce when the user enters the string shown in bold:

Sample Output: (the user enters the string shown in bold)

Please enter a string.

Apple

Please enter another string.

Orange

The first string's length is odd.

The second string's length is even.

The two strings are different.

The second string is lexically larger.

The first character of the first string is A

The first character of the second string is O

The concatenation of two strings is "AppleOrange"

The first string using upper case letters: APPLE

The second string using upper case letters: ORANGE

Reference no: EM132088629

Questions Cloud

Display all numbers in this computation using labels : If the second number is NOT a zero, do the operation, display all numbers in this computation using labels, and add them to the results.txt file.
Electrolyte balance is very important in our body : "Electrolyte balance is very important in our body. When our electrolytes are out of balance, it negatively affects other systems
Electrolyte control the functionality of a body system : Pick a system of the body and research the effects of an electrolyte imbalance. How can something as simple as an electrolyte control the functionality of a bod
Action potential generation and conduction : What effect would this have on action potential generation and conduction
Computes the square root of the sum of num1 and num2 : Write an assignment statement that computes the square root of the sum of num1 and num2 and assigns the result to num3.
Provide a synopsis of the clotting cascade : 1. Provide a synopsis of the clotting cascade as well as how 2 anticoagulant medications affect it.
Development of the abdominal muscles : Analyze each exercise with regard to the activity of the abdominal muscles. Defend your answer.
Create a text input box for an email address : Create a Web document called l5p1.html that displays one of the images from lab 2 in approximately the center of the page; centering need not be exact.
Components of the endocrine system : Can you come up with your own analogy involving 3 components of the endocrine system. The analogy needs to be about how they work together to function properly.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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