Been working on this for so long I am lost and my mind is mush,lol.
On line 106 i have this error (class camera is public, should be declared in a file named camera.java
)
I have a lot of incompatible types required: java.lang.String found: camera.camera.string errors
.
I do not know what they mean and I tired many ways to fix the problem. I am a newbie and this is my second time taking this class. Running out of gas and need help, please.
package camera;
import java.util.Scanner;
/**
*
* @author pastryfdr
*/
public class Camera {
private static int count;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
// creating scanner to obtain input from command window
int item_no;
String product_name;
String department;
double unit_in_stock;
double price_unit;
double value_of_inventory = 0;
System.out.print("Enter Product Name: ");//prompt
product_name = input.next();
System.out.println();
System.out.print("Enter Item Number: ");//prompt
item_no = input.nextInt();
System.out.println();
System.out.print("Enter Price of Each Unit: ");//prompt
price_unit = input.nextDouble();
System.out.println();
System.out.print("Units in Stock: ");//prompt
unit_in_stock = input.nextDouble();
System.out.println();
// array
camera[] mycamera = new camera[10];
for (int i = 0; i < count; i++)
{ //count number of new cameras
System.out.print("Enter Product Name: ");//prompt
product_name = input.next();
System.out.println();
value_of_inventory = unit_in_stock * price_unit;
System.out.print("Enter Item Number: ");//prompt
item_no = input.nextInt();
System.out.println();
System.out.print("Enter Price of Each Unit: ");//prompt
price_unit = input.nextDouble();
System.out.println();
System.out.print("Units in Stock: ");//prompt
unit_in_stock = input.nextDouble();
System.out.println();
camera newcamera = newcamera(product_name, item_no, price_unit, unit_in_stock);
// put
mycamera[count]= newcamera;
}//end for
for (int i = 0; i < count; i++)
//print
System.out.println("The product number is " +item_no);
System.out.println("The name of the product is "+product_name);
System.out.println("The number of units in stock is "+unit_in_stock);
System.out.println("The price of each unit " +price_unit);
System.out.println("The value of inventory is "+value_of_inventory);
System.out.println(); // space
}// end for
private static camera newcamera(String product_name, int item_no, double price_unit, double unit_in_stock) {
throw new UnsupportedOperationException("Not yet implemented");
}
private static class camera {
public camera() {
}
}
}// end main container
public class camera {
private static class string {
public string() {
}
}
String department = "";
String product_name = "";
int item_no = 0;
double price_unit = 0.0;
double unit_in_stock = 0.0;
// contructor
private camera (string department, string product_name, int item_no, double unit_in_stock)
{
this.department = department;
this.product_name = product_name;
this.item_no = item_no;
this.price_unit = price_unit;
this.unit_in_stock = unit_in_stock;
}
// set and get method
public String getdepartment()
{
return department;
}
public void setdepartment(string department)
{
this.department = department;
}
public String getproduct_name()
{
return product_name;
}
public void setproduct_name (string product_name)
{
this.product_name = product_name;
}
public int getitem_no()
{
return item_no;
}
public void setitem_no (int item_no)
{
this.item_no = item_no;
}
public double getprice_unit()
{
return price_unit;
}
public void setprice_unit (double price_unit)
{
this.price_unit = price_unit;
}
public double getunit_in_stock()
{
return unit_in_stock;
}
public void setunit_in_stock (double unit_in_stock)
{
this.unit_in_stock = unit_in_stock;
}
}
// end