value of array string kasi yung isa tapos yung isa string lang.Sir gumana sya ☺☺☺
bakit kaya pag if(cinema[0] == cinemaInput && cinema[1] == môviêInput? Hindi gumagana?
Pero pag if(cinema[0].equals(cinemaInput) && cinema[1].equals(môviêInput) gumagana sya.
Ang hindi ko nlng ma intindihan sir yun sa total = stoi(cinema[3] * seatInput;
Nag search ako ang stoi pala sa c++ parang pang palit ng String to integer tama po ba o mali
Sa java po meron Integer.parseInt kaso pano po kaya yun icoconvert sa Java sir. Nga pala po sir salamat tulong. Sana matulungan nyo po pa ako sa mga susunod na mga katanungan ko. Salamat po.
bale yung myString doon eh yung value dun sa array.Sir gumana sya ☺☺☺
bakit kaya pag if(cinema[0] == cinemaInput && cinema[1] == môviêInput? Hindi gumagana?
Pero pag if(cinema[0].equals(cinemaInput) && cinema[1].equals(môviêInput) gumagana sya.
Ang hindi ko nlng ma intindihan sir yun sa total = stoi(cinema[3] * seatInput;
Nag search ako ang stoi pala sa c++ parang pang palit ng String to integer tama po ba o mali
Sa java po meron Integer.parseInt kaso pano po kaya yun icoconvert sa Java sir. Nga pala po sir salamat tulong. Sana matulungan nyo po pa ako sa mga susunod na mga katanungan ko. Salamat po.
Ah Galing Salamat Sir. Pano Kita Message Pag need ko Help mo Hindi pa ako Establish Eh.value of array string kasi yung isa tapos yung isa string lang.
Kaya .equals dapat.
para maging int ang string:
myInt = Integer.parseInt(myString);
Bale.. Kukuha ka ng number of seats from user.
Tapos:
total = Integer.parseInt(myString) * inputSeat
lang.
Dito lang.Ah Galing Salamat Sir. Pano Kita Message Pag need ko Help mo Hindi pa ako Establish Eh.
Sir nag error pag total = Integer.parseInt(cinema[3]) * seatInput;Dito lang.
check mo dapat int ang seatInput. Tapos inputUser.nextInt() ang gamitin mo.Sir nag error pag total = Integer.parseInt(cinema[3]) * seatInput;
Sir tama po int po pala dapat bale ang error pala yung sa while loop yung mamimili ng time hindi nya kasi nakukuha yung timeInput = cinema[4].check mo dapat int ang seatInput. Tapos inputUser.getInt() ang gamitin mo.
seatInput lang ang hindi String. int dapat yan.
Sir tama po int po pala dapat bale ang error pala yung sa while loop yung mamimili ng time hindi nya kasi nakukuha yung timeInput = cinema[4].
Sir pano ba maging marunong sa pag popogram?
import java.util.*;
public class CinemaTickitingMachine{
static String cinemaInput;
static int cinemaIndex = 1;
static String môviêInput;
static String timeInput;
static String seatInput;
static boolean successPicking = false;
static float total;
static String currentCinemaIndex;
static Scanner userInput = new Scanner(System.in);
static String cinema [][] = new String [][] {
{"Cinema 1", "A", "Avengers Infinity War [PG]", "200", "10:30am - 12:30pm", "12:30pm - 2:30pm"},
{"Cinema 1", "B", "Ant Man [PG]", "230", "2:30pm - 4:30pm", "4:30pm - 6:30pm"},
{"Cinema 1", "C", "Rampage [PG]", "250", "6:30pm - 8:30pm", "8:30pm - 10:30pm"},
{"Cinema 2", "A", "The How's of Us [G]", "210", "10:30am - 12:30pm", "12:30pm - 2:30pm"},
{"Cinema 2", "B", "How I Met Your Mother [PG]", "220", "2:30pm - 4:30pm", "4:30pm - 6:30pm"},
{"Cinema 2", "C", "Fifty Shades [SPG]", "215", "6:30pm - 8:30pm", "8:30pm - 10:30pm"},
{"Cinema 3", "A", "The Nun [SPG]", "220", "10:30am - 12:30pm", "12:30pm - 2:30pm"},
{"Cinema 3", "B", "Anabelle [SPG]", "225", "2:30pm - 4:30pm", "4:30pm - 6:30pm"},
{"Cinema 3", "C", "The Purge [SPG]", "190", "6:30pm - 8:30pm", "8:30pm - 10:30pm"}
};
public static void main (String [] args){
displayMenu();
pickTheCinemaAndmôviê();
}
static void displayMenu(){
System.out.println("<<<<<<[Welcome to World Cinema]>>>>>>\n");
System.out.println("Cinema List:\n");
System.out.println(cinema[0][0] + ":\n");
currentCinemaIndex = cinema[0][0];
//Show the môviês in each cinema
for(int i = 0; i < 9; i++)
{
if(currentCinemaIndex != cinema[0])
{
currentCinemaIndex = cinema[0];
System.out.println("======================================\n");
System.out.println(cinema[0] + ":\n");
}
System.out.println( "[" + cinema[1] + "] " + cinema[2] + "\n");
}
//Pick what cinema
System.out.println( "\n\nSelect cinema [1|2|3]: ");
cinemaInput = userInput.next();
cinemaInput = "Cinema " + cinemaInput;
//Pick what môviê
System.out.println( "Select what môviê [A|B|C]: ");
môviêInput = userInput.next();
System.out.println( "======================================\n");
System.out.println( "Selected:\n\n");
}
static void pickTheCinemaAndmôviê(){
//Search the picked cinema and môviê then output in the screen
for(int i = 0; i < 9; i++)
{
if(cinema[0] == cinemaInput && cinema[0] == môviêInput)
{
System.out.println( cinema[2] + "\n");
System.out.println("Price: P " + cinema[3] + "\n");
System.out.println( "Time Available: \n");
System.out.println("[1]" + cinema[4] + "\n");
System.out.println("[2]" + cinema[5] + "\n");
System.out.println("[3]" + "CANCEL\n\n");
while (true)
{
System.out.println("Select time [1|2]: ");
timeInput = userInput.next();
if(timeInput == "1")
{
timeInput = cinema[4];
successPicking = true;
break;
}
else if (timeInput == "2")
{
timeInput = cinema[5];
successPicking = true;
break;
}
else if (timeInput == "3")
{
//system("cls");
//ibig sabihin po ba ng system("cls");
//ganito po ba yan sa Java?
System.exit(0);
break;
}
else
{
System.out.println("Invalid input, please try again...");
}
}
if(successPicking)
{
System.out.println("How many seats or tickets: ");
seatInput = userInput.next();
//total = stoi(cinema[3]) * seatInput;
//hindi ko alam kung ano stoi sa c++ sir
//kinomment ko hindi ako kasi alam kung pano ko icocovert sa Java yan.
System.out.println("======================================\n");
System.out.println("môviê\n");
System.out.println(cinema[2] + "\n");
System.out.println("Time: " + timeInput + "\n");
System.out.println("Price: P " + cinema[3] + "\n");
System.out.println("Seats: " + seatInput + "\n");
System.out.println("Total: " + total);
}
else
{
break;
}
}
}
return;
}
}
Ang galing galing nyo po talaga sir tama yung equal.Code:import java.util.*; public class CinemaTickitingMachine{ static String cinemaInput; static int cinemaIndex = 1; static String môviêInput; static String timeInput; static String seatInput; static boolean successPicking = false; static float total; static String currentCinemaIndex; static Scanner userInput = new Scanner(System.in); static String cinema [][] = new String [][] { {"Cinema 1", "A", "Avengers Infinity War [PG]", "200", "10:30am - 12:30pm", "12:30pm - 2:30pm"}, {"Cinema 1", "B", "Ant Man [PG]", "230", "2:30pm - 4:30pm", "4:30pm - 6:30pm"}, {"Cinema 1", "C", "Rampage [PG]", "250", "6:30pm - 8:30pm", "8:30pm - 10:30pm"}, {"Cinema 2", "A", "The How's of Us [G]", "210", "10:30am - 12:30pm", "12:30pm - 2:30pm"}, {"Cinema 2", "B", "How I Met Your Mother [PG]", "220", "2:30pm - 4:30pm", "4:30pm - 6:30pm"}, {"Cinema 2", "C", "Fifty Shades [SPG]", "215", "6:30pm - 8:30pm", "8:30pm - 10:30pm"}, {"Cinema 3", "A", "The Nun [SPG]", "220", "10:30am - 12:30pm", "12:30pm - 2:30pm"}, {"Cinema 3", "B", "Anabelle [SPG]", "225", "2:30pm - 4:30pm", "4:30pm - 6:30pm"}, {"Cinema 3", "C", "The Purge [SPG]", "190", "6:30pm - 8:30pm", "8:30pm - 10:30pm"} }; public static void main (String [] args){ displayMenu(); pickTheCinemaAndmôviê(); } static void displayMenu(){ System.out.println("<<<<<<[Welcome to World Cinema]>>>>>>\n"); System.out.println("Cinema List:\n"); System.out.println(cinema[0][0] + ":\n"); currentCinemaIndex = cinema[0][0]; //Show the môviês in each cinema for(int i = 0; i < 9; i++) { if(currentCinemaIndex != cinema[0]) { currentCinemaIndex = cinema[0]; System.out.println("======================================\n"); System.out.println(cinema[0] + ":\n"); } System.out.println( "[" + cinema[1] + "] " + cinema[2] + "\n"); } //Pick what cinema System.out.println( "\n\nSelect cinema [1|2|3]: "); cinemaInput = userInput.next(); cinemaInput = "Cinema " + cinemaInput; //Pick what môviê System.out.println( "Select what môviê [A|B|C]: "); môviêInput = userInput.next(); System.out.println( "======================================\n"); System.out.println( "Selected:\n\n"); } static void pickTheCinemaAndmôviê(){ //Search the picked cinema and môviê then output in the screen for(int i = 0; i < 9; i++) { if(cinema[0] == cinemaInput && cinema[0] == môviêInput) { System.out.println( cinema[2] + "\n"); System.out.println("Price: P " + cinema[3] + "\n"); System.out.println( "Time Available: \n"); System.out.println("[1]" + cinema[4] + "\n"); System.out.println("[2]" + cinema[5] + "\n"); System.out.println("[3]" + "CANCEL\n\n"); while (true) { System.out.println("Select time [1|2]: "); timeInput = userInput.next(); if(timeInput == "1") { timeInput = cinema[4]; successPicking = true; break; } else if (timeInput == "2") { timeInput = cinema[5]; successPicking = true; break; } else if (timeInput == "3") { //system("cls"); //ibig sabihin po ba ng system("cls"); //ganito po ba yan sa Java? System.exit(0); break; } else { System.out.println("Invalid input, please try again..."); } } if(successPicking) { System.out.println("How many seats or tickets: "); seatInput = userInput.next(); //total = stoi(cinema[3]) * seatInput; //hindi ko alam kung ano stoi sa c++ sir //kinomment ko hindi ako kasi alam kung pano ko icocovert sa Java yan. System.out.println("======================================\n"); System.out.println("môviê\n"); System.out.println(cinema[2] + "\n"); System.out.println("Time: " + timeInput + "\n"); System.out.println("Price: P " + cinema[3] + "\n"); System.out.println("Seats: " + seatInput + "\n"); System.out.println("Total: " + total); } else { break; } } } return; } }
Subukan mo ulit na .equals ang gamitin mo.
Sir meron ka po ba dyan mga exercise na madali lang pang begginner po.Ang
Ang galing galing nyo po talaga sir tama yung equal.
Sir pa help nman ako sa popogram gusto ko kasi talaga matuto yung pag meron nag tanon sayo masasagot mo tulad nyo po lahat po ng tinatanong ko nasasagot nyo po how to be you po sabi nga ng mga bata ngayon ☺
Wala eh hanap ka nalang sa net.S
Sir meron ka po ba dyan mga exercise na madali lang pang begginner po.
Sir pwede ako mag suggest hindi ko alam kong tama pero try mo mag enum tapus switch.pano sir ma call yung q1e() (yung my white circle) gamit yung Switch statement(red circle)?
bali po kapag nag output na po yung number the mag cacall po siya sa quiestion()
example: case 1: 1 then call q1e();
pano po yan di ko po mafix e hehe sana po matulongan nyo po ako
mag rarandom kasi sir yung number 1-15. the each number ay my naka assign na question. pero di ako marunong kun pano mag call nang question na naka assign per number. heheSir pwede ako mag suggest hindi ko alam kong tama pero try mo mag enum tapus switch.
Sa c++ ang function call:mag rarandom kasi sir yung number 1-15. the each number ay my naka assign na question. pero di ako marunong kun pano mag call nang question na naka assign per number. hehe
functionName(parameters);
q1e();
try ko po master heheSa c++ ang function call:
bale sa case mo.Code:functionName(parameters);
Code:q1e();
Ilagay mo lang sa case block tapos break;
Yan ba instruction sa inyo? Through function ang pagtawag ng question?pano sir ma call yung q1e() (yung my white circle) gamit yung Switch statement(red circle)?
bali po kapag nag output na po yung number the mag cacall po siya sa quiestion()
example: case 1: 1 then call q1e();
pano po yan di ko po mafix e hehe sana po matulongan nyo po ako
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?