Here is a Java code that displays the price difference between DSLR and Mirrorless cameras for different manufacturers:
```java
public class CameraTechnologyReport {
public static void main(String[] args) {
String[] manufacturers = {"CANON", "SONY", "NIKON"};
int[][] prices = {
{10500, 8500},
{9500, 7200},
{12000, 8000}
};
int totalDifference = 0;
int maxDifference = 0;
String manufacturerWithMaxDifference = "";
System.out.println("Camera Technology Report");
System.out.println("------------------------");
for (int i = 0; i < manufacturers.length; i++) {
String manufacturer = manufacturers[i];
int[] manufacturerPrices = prices[i];
int difference = manufacturerPrices[0] - manufacturerPrices[1];
totalDifference += difference;
System.out.println("\nManufacturer: " + manufacturer);
System.out.println("Mirrorless cost: R" + manufacturerPrices[0]);
System.out.println("DSLR cost: R" + manufacturerPrices[1]);
System.out.println("Price difference: R" + difference);
if (difference >= 2500) {
System.out.println("***");
}
if (difference > maxDifference) {
maxDifference = difference;
manufacturerWithMaxDifference = manufacturer;
}
}
System.out.println("\nTotal price difference for all manufacturers: R" + totalDifference);
System.out.println("Manufacturer with the greatest cost difference: " + manufacturerWithMaxDifference);
}
}
```
This code defines a `manufacturers` array that holds the names of the camera manufacturers. The `prices` array is a two-dimensional array that holds the Mirrorless and DSLR prices for each manufacturer.
The code then iterates through the arrays and calculates the price difference for each manufacturer. It also keeps track of the total difference and finds the manufacturer with the greatest difference.
Finally, the code displays the camera technology report by printing the manufacturer names, Mirrorless and DSLR prices, and the price difference. If the difference is greater than or equal to 2500, it displays three stars (`***`). It also prints the total price difference for all manufacturers and the manufacturer with the greatest cost difference.
Write a Java application to display the price difference between two types of camera
technologies, DSLR and Mirrorless. Display the camera manufacturer and the cost of a DSLR versus
a Mirrorless camera. Below represents the camera cost comparisons:
CANON:
MIRRORLESS - R 10 500
DSLR - R 8 500
SONY:
MIRRORLESS - R 9 500
DSLR - R 7 200
NIKON:
MIRRORLESS - R 12 000
DSLR - R 8 000
Using single and two-dimensional arrays, produce the camera technology report and include the
total calculated difference for each camera manufacturer. If the difference between the
Mirrorless camera and DSLR is greater than or equal to R2 500, then display three stars ***.
In your solution, include the camera manufacturer with the greatest cost difference.
in java
1 answer