Answer:
Console.WriteLine("Format Double: {0:n3}", num); //formatting output with 3 digit decimal point
Explanation:
Following are the program in c#
using System; // namespace
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Tasks
{
class Program
2 // program2
{
static void Main(string[] args) // Main function
{
double num = 958254.73789621; // variables
Console.WriteLine("Format Double: {0:n3}", num); //formatting output with 3 digit decimal point
Console.Read();
}
}
}
Output:
Format Double : 958254.737
Here we have declared a variable num of type double which store the value num=958254.73789621. To do format with the double number i used a syntax {0:n3}. This syntax {0:n3}is separated with :(colon) here 0 represent the value before the decimal point that is 958254 and n3 represent the value upto 3 decimal points. Hence this statement give the output with three digit after the decimal point .
Answer:Have a good dayyyyy
Explanation: can i be brainliest pls pls
Answer:
Code:-
// Program takes a hot dog order
// And determines price
using System;
using static System.Console;
class DebugFour1
{
static void Main()
{
const double BASIC_DOG_PRICE = 2.00;
const double CHILI_PRICE = 0.69;
const double CHEESE_PRICE = 0.49;
String wantChili, wantCheese;
double price;
Write("Do you want chili on your dog? ");
wantChili = ReadLine();
Write("Do you want cheese on your dog? ");
wantCheese = ReadLine();
if (wantChili == "Y")
{
if (wantCheese == "Y")
price = BASIC_DOG_PRICE + CHILI_PRICE + CHEESE_PRICE;
else
price = BASIC_DOG_PRICE + CHILI_PRICE;
}
else
{
if (wantCheese == "Y")
price = BASIC_DOG_PRICE + CHEESE_PRICE;
else
price = BASIC_DOG_PRICE;
}
WriteLine("Your total is {0}", price.ToString("C"));
}
}
Answer:
See explaination
Explanation:
public class Circle {
private double radius;
private Location location;
private String name;
/* (non-Javadoc)
* atsee java.lang.Object#hashCode()
*/
atOverride
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((location == null) ? 0 : location.hashCode());
long temp;
temp = Double.doubleToLongBits(radius);
result = prime * result + (int) (temp ^ (temp >>> 32));
return result;
}
/* (non-Javadoc)
* atsee java.lang.Object#equals(java.lang.Object)
*/
atOverride
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Circle other = (Circle) obj;
if (location == null) {
if (other.location != null)
return false;
} else if (!location.equals(other.location))
return false;
if (Double.doubleToLongBits(radius) != Double.doubleToLongBits(other.radius))
return false;
return true;
}
NOTE: Replace all the "at" within the program with the at symbol ie shift 2.