In this chapter, you learned that although a double and a decimal both hold floating-point numbers, a double can hold a larger value. Write a C# program named DoubleDecimalTest that declares and displays two variables—a double and a decimal. Experiment by assigning the same constant value to each variable so that the assignment to the double is legal but the assignment to the decimal is not.

Answers

Answer 1
Answer:

Answer:

The DoubleDecimalTest class is as follows:

using System;

class DoubleDecimalTest {

 static void Main() {

     double doubleNum = 173737388856632566321737373676D;  

    decimal decimalNum = 173737388856632566321737373676M;

   Console.WriteLine(doubleNum);

   Console.WriteLine(decimalNum);  }}

Explanation:

Required

Program to test double and decimal variables in C#

This declares and initializes double variable doubleNum

     double doubleNum = 173737388856632566321737373676D;

This declares and initializes double variable decimalNum (using the same value as doubleNum)

     decimal decimalNum = 173737388856632566321737373676M;

This prints doubleNum

   Console.WriteLine(doubleNum);

This prints decimalNum

   Console.WriteLine(decimalNum);

Unless the decimal variable is commented out or the value is reduced to a reasonable range, the program will not compile without error.


Related Questions

An employee’s total weekly pay equals the hourly wage multiplied by the total number of regular hours, plus any overtime pay.Overtime pay equals the total overtime hours multiplied by 1.5 times the hourly wage.Write a program that takes as inputs the hourly wage, total regular hours, and total overtime hours and displays an employee’s total weekly pay.Below is an example of the program inputs and output:Enter the wage: $15.50Enter the regular hours: 40Enter the overtime hours: 12The total weekly pay is $899.0
)when you classify data into groups and subgroups you are using a(n) ____ order?A. CircularB. HierarchicalC. LinearD. Group
Implement the logic function ( , , ) (0,4,5) f a b c m =∑ in 4 different ways. You have available 3to-8 decoders with active high (AH) or active low (AL) outputs and OR, AND, NOR and NAND gates with as many inputs as needed. In every case clearly indicate which is the Most Significant bit (MSb) and which is the Least Significant bit (LSb) of the decoder input.
What component can be used for user input or display of output?JButtonJLabelJTextFieldJFrame
When a JSP page is compiled, what is it turned into?? Applet? Servlet? Application? Midlet

A customer has engaged your software development company to develop a new order-processing system. However, the time frames are very tight and inflexible for delivery of at least the basic part of the new system. Further, user requirements are sketchy and unclear. a. What is the best system development strategy that might be advantageous to use in this engagement? b. What is the potential downside to using the strategy described in the part a?

Answers

Sorry b. Not answered. Thanks. Rate it if this helps.

The scope of a variable declared inside of a function is:a) Local - within that function

b) Within that file only

c) global

Answers

Answer:

a

Explanation:

The variable declared is local within that function that is the declared variable is accessible inside that block itself, it cannot be accessible outside the given function.

ex - void add()

{

int a=10,  b=20 , c ;

c = a + b ;

cout << c ;

}

int main()

{

cout << "value for c is :"<< c ;

return 0;

}

Here inside the add function variable a, b,c are declared and initialized inside the function.

At what layer in the TCP/IP protocol hierarchy could a firewall be placed to filter incoming traffic by means of:a) message content
b) source address
c) type of application​​

Answers

The most significant protocol at layer 3, often known as the network layer, is the Internet Protocol, or IP.The IP protocol, the industry standard for packet routing among interconnected networks, is the source of the Internet's name.  Thus, option C is correct.

What are the TCP/IP protocol hierarchy could a firewall?

Application-layer firewalls operate at the TCP/IP stack's application level (all browser traffic, or all telnet or ftp traffic, for example), and thus have the ability to intercept any packets going to or from an application. They stop different packets (usually dropping them without acknowledgment to the sender).

Firewalls are frequently positioned at a network's edge. An external interface is the one that is located outside the network, while an internal interface is the one that is located inside the firewall.

Therefore, The terms “unprotected” and “protected,” respectively, are sometimes used to describe these two interfaces.

Learn more about TCP/IP here:

brainly.com/question/27742993

#SPJ2

The answer is c) type of application

Choose the missing term
-------time
time.sleep(3)

Answers

Answer:

import

Explanation:

If this is python, you'll have to import the time module.

e interesting application of two-dimensional arrays is magic squares. A magic square is a square matrix in which the sum of every row, every column, and both diagonals is the same. Magic squares have been studied for many years, and there are some particularly famous magic squares. Write a program to determine whether a series of square matrices are magic or not. The first line of input for each square specifies the size of the square(number of rows and columns). The square elements follow, one row per line. The end of the data is indicated by -1. Create a class called Square that has methods to construct a square of a specified size, to read in the elements of t

Answers

Answer:

Check the explanation

Explanation:

// Define a Square class with methods to create and read in

// info for a square matrix and to compute the sum of a row,

// a column, either diagonal, and whether it is magic.

//

// ****************************************************************

import java.util.Scanner;

import java.io.*;

public class Square {

int[][] square;

//--------------------------------------

//create new square of given size

//--------------------------------------

public Square(int size) {

square = new int[size][size];

}

//-----------------------------------------------

//return the sum of the values in the given row

//-----------------------------------------------

public int sumRow(int row) {

// Add your code here

int sum = 0;

for (int i = 0; i < square.length; i++) {

sum = sum + square[row][i];

}

return sum;

}

//-------------------------------------------------

//return the sum of the values in the given column

//-------------------------------------------------

public int sumCol(int col) {

// Add your code here

int sum = 0;

for (int i = 0; i < square.length; i++) {

sum = sum + square[i][col];

}

return sum;

}

//---------------------------------------------------

//return the sum of the values in the main diagonal

//---------------------------------------------------

public int sumMainDiag() {

// Add your code here

int sum = 0;

for (int i = 0; i < square.length; i++) {

sum = sum + square[i][i];

}

return sum;

}

//---------------------------------------------------------------

//return the sum of the values in the other ("reverse") diagonal

//---------------------------------------------------------------

public int sumOtherDiag() {

// Add your code here

int sum = 0;

for (int i = 0; i < square.length; i++) {

sum = sum + square[square.length - i - 1][i];

}

return sum;

}

//-------------------------------------------------------------------

//return true if the square is magic (all rows, cols, and diags have

//same sum), false otherwise

//-------------------------------------------------------------------

public boolean magic() {

// Add your code here. Check if the sum of main diagonal equals the other diagonal,

// also if all rows and all columns sums equal to the diagonal as well. Any uneuqal will

// terminate the comparison.

int d1 = sumMainDiag();

int d2 = sumOtherDiag();

if (d1 != d2) {

return false;

}

for (int i = 0; i < square.length; i++) {

if (d1 != sumRow(i) || d1 != sumCol(i)) {

return false;

}

}

return true;

}

//----------------------------------------------------

//read info into the square from the standard input.

//----------------------------------------------------

public void readSquare(Scanner scan) {

for (int row = 0; row < square.length; row++) {

for (int col = 0; col < square.length; col++) {

square[row][col] = scan.nextInt();

}

}

}

//---------------------------------------------------

//print the contents of the square, neatly formatted

//---------------------------------------------------

public void printSquare() {

for (int row = 0; row < square.length; row++) {

for (int col = 0; col < square.length; col++) {

System.out.print(square[row][col] + "\t");

}

System.out.println();

}

}

}

// ****************************************************************

// SquareTest.java

//

// Uses the Square class to read in square data and tell if

// each square is magic.

//

// ****************************************************************

class SquareTest {

public static void main(String[] args) throws IOException {

File file = new File("magicData.txt");

Scanner scan = new Scanner(file);

int count = 1; //count which square we're on

int size = scan.nextInt(); //size of next square

//Expecting -1 at bottom of input file

while (size != -1) {

//create a new Square of the given size

Square magicSquare = new Square(size);

//call its read method to read the values of the square

magicSquare.readSquare(scan);

System.out.println("\n******** Square " + count + " ********");

//print the square

magicSquare.printSquare();

//print the sums of its rows

for (int row = 0; row < size; row++) {

System.out.println("Sum of row " + row + ": "

+ magicSquare.sumRow(row));

}

//print the sums of its columns

for (int col = 0; col < size; col++) {

System.out.println("Sum of column " + col + ": "

+ magicSquare.sumCol(col));

}

//print the sum of the main diagonal

System.out.println("Sum of the main diagonal: "

+ magicSquare.sumMainDiag());

//print the sum of the other diagonal

System.out.println("Sum of the other diagonal: "

+ magicSquare.sumOtherDiag());

//determine and print whether it is a magic square

if (magicSquare.magic()) {

System.out.println("It's a magic square!");

} else {

System.out.println("It's not a magic square!");

}

System.out.println();

//get size of next square

size = scan.nextInt();

count++;

}

}

}

Answer:

See explaination

Explanation:

/ Define a Square class with methods to create and read in

// info for a square matrix and to compute the sum of a row,

// a column, either diagonal, and whether it is magic.

//

// ************************************************************

import java.util.Scanner;

import java.io.*;

public class Square {

int[][] square;

//--------------------------------------

//create new square of given size

//--------------------------------------

public Square(int size) {

square = new int[size][size];

}

//-----------------------------------------------

//return the sum of the values in the given row

//-----------------------------------------------

public int sumRow(int row) {

// Add your code here

int sum = 0;

for (int i = 0; i < square.length; i++) {

sum = sum + square[row][i];

}

return sum;

}

//-------------------------------------------------

//return the sum of the values in the given column

//-------------------------------------------------

public int sumCol(int col) {

// Add your code here

int sum = 0;

for (int i = 0; i < square.length; i++) {

sum = sum + square[i][col];

}

return sum;

}

//---------------------------------------------------

//return the sum of the values in the main diagonal

//---------------------------------------------------

public int sumMainDiag() {

// Add your code here

int sum = 0;

for (int i = 0; i < square.length; i++) {

sum = sum + square[i][i];

}

return sum;

}

//---------------------------------------------------------------

//return the sum of the values in the other ("reverse") diagonal

//---------------------------------------------------------------

public int sumOtherDiag() {

// Add your code here

int sum = 0;

for (int i = 0; i < square.length; i++) {

sum = sum + square[square.length - i - 1][i];

}

return sum;

}

//-------------------------------------------------------------------

//return true if the square is magic (all rows, cols, and diags have

//same sum), false otherwise

//-------------------------------------------------------------------

public boolean magic() {

// Add your code here. Check if the sum of main diagonal equals the other diagonal,

// also if all rows and all columns sums equal to the diagonal as well. Any uneuqal will

// terminate the comparison.

int d1 = sumMainDiag();

int d2 = sumOtherDiag();

if (d1 != d2) {

return false;

}

for (int i = 0; i < square.length; i++) {

if (d1 != sumRow(i) || d1 != sumCol(i)) {

return false;

}

}

return true;

}

//----------------------------------------------------

//read info into the square from the standard input.

//----------------------------------------------------

public void readSquare(Scanner scan) {

for (int row = 0; row < square.length; row++) {

for (int col = 0; col < square.length; col++) {

square[row][col] = scan.nextInt();

}

}

}

//---------------------------------------------------

//print the contents of the square, neatly formatted

//---------------------------------------------------

public void printSquare() {

for (int row = 0; row < square.length; row++) {

for (int col = 0; col < square.length; col++) {

System.out.print(square[row][col] + "\t");

}

System.out.println();

}

}

}

// ****************************************************************

// SquareTest.java

//

// Uses the Square class to read in square data and tell if

// each square is magic.

//

// ****************************************************************

class SquareTest {

public static void main(String[] args) throws IOException {

File file = new File("magicData.txt");

Scanner scan = new Scanner(file);

int count = 1; //count which square we're on

int size = scan.nextInt(); //size of next square

//Expecting -1 at bottom of input file

while (size != -1) {

//create a new Square of the given size

Square magicSquare = new Square(size);

//call its read method to read the values of the square

magicSquare.readSquare(scan);

System.out.println("\n******** Square " + count + " ********");

//print the square

magicSquare.printSquare();

//print the sums of its rows

for (int row = 0; row < size; row++) {

System.out.println("Sum of row " + row + ": "

+ magicSquare.sumRow(row));

}

//print the sums of its columns

for (int col = 0; col < size; col++) {

System.out.println("Sum of column " + col + ": "

+ magicSquare.sumCol(col));

}

//print the sum of the main diagonal

System.out.println("Sum of the main diagonal: "

+ magicSquare.sumMainDiag());

//print the sum of the other diagonal

System.out.println("Sum of the other diagonal: "

+ magicSquare.sumOtherDiag());

//determine and print whether it is a magic square

if (magicSquare.magic()) {

System.out.println("It's a magic square!");

} else {

System.out.println("It's not a magic square!");

}

System.out.println();

//get size of next square

size = scan.nextInt();

count++;

}

}

}

What is a digital projector? How is it different from computer screen?

Answers

Answer:

An LCD projector is a type of video projector for displaying video, images, or computer data on a screen or other flat surface. It is a modern equivalent of the slide projector or overhead projector.

It's different because in a computer display, the screen is the physical surface on which visual information is presented. This surface is usually made of glass.

Explanation:

A digital projector is a device that projects video or images onto a large screen, suitable for shared viewing in larger settings. It differs from a computer screen in terms of size, portability, shared viewing capabilities, image quality, source connectivity, and adjustments.

A digital projector is a device that takes a video or image signal from a computer, DVD player, or other multimedia source and projects it onto a large screen or surface.

The key differences between a digital projector and a computer screen:

Size: The most obvious difference is the size of the display.

Portability: Computer screens are generally fixed and not easily portable, whereas digital projectors are often designed for mobility.

Shared Viewing: A computer screen is designed for individual or small group viewing at close distances, while a digital projector is meant for larger audiences.

Image Quality: Digital projectors vary in imagequality, and high-quality projectors can offer impressive resolution and brightness suitable for movie screenings or professional presentations.

Source Connectivity: Both a computer screen and a digital projector can receive input from computers and other multimedia sources.

Placement and Adjustment: Digital projectors often provide manual or automatic keystone correction and focus adjustments to ensure the projected image remains proportional and clear on the screen or surface.

Hence,  a digital projector is a device used to project large-scale images or video onto a screen or surface, suitable for shared viewing in larger settings.

To learn more on Digital projector click here:

brainly.com/question/19486217

#SPJ3