assignment 1.)display products table and employee table with conditional rendering true means products table false means employee
Forwarded from SathyaReact
I will talk with technical team tomorrow regarding pending syllabus
Java Hyd Team
WhatsApp: https://chat.whatsapp.com/F7kqpKp6WFZJQiuTXpYH1K
Will update some more job updates by late night today 😊 join fast as old opportunities you can't get now so don't miss next upcoming opportunities
You can share channel links with your friends too it's 100% to join even if all job referral are free for everyone
Send your resumes for referrals we will refer to many product base companies ( good companies like PWC, oracle , CTS , Benz , Jenkins, and many more)
Those whose concept is clear in javascript and react can ping us so that we can make a list for referrals
👍1
import java.util.*;public class Lucky_Number { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter the car no:"); int num = sc.nextInt(); if (num < 0000 || num > 9999) { System.out.println(num + " is not a valid car number"); } else { int sum = 0; while (num > 0) { sum += num % 10; num /= 10; } if (sum % 3 == 0 sum % 5 == 0 sum % 7 == 0) {
System.out.println("Lucky Number");
} else {
System.out.println("Sorry its not my lucky number");
}
}
}}
if(!isNaN(form.elements[i].value))
{
alert("This Field must be Char's")
form.elements[i].value=""
form.elements[i].focus()
return false
}
}
if(document.F1.password.value!=document.F1.repassword.value)
{
alert("Check Confirm PWD");
document.F1.repassword.value=""
document.F1.repassword.focus()
return false
}
if(!isNaN(document.F1.phone.value))
{
if(document.F1.phone.value >9999999999 )
{
alert("ye kabhi nhi aayegi")
document.F1.phone.value=""
document.F1.phone.focus()
return false
}
}
else
{
alert("This field must be number")
document.F1.phone.value=""
return false
}
if(!isNaN(document.F1.amount.value))
{
if(document.F1.amount.value < 500)
{
alert("Minimum Balance should be 500 /-")
document.F1.amount.value=""
document.F1.amount.focus()
return false
}
}
else
{
alert("This field must be number")
document.F1.amount.value=""
return false
}
for(var i=0; i<form.elements.length; i++)
{
if(form.elements[i].value == "")
{
alert("Fill out all Fields")
document.F1.username.focus()
return false
}
}
return true
}
{
alert("This Field must be Char's")
form.elements[i].value=""
form.elements[i].focus()
return false
}
}
if(document.F1.password.value!=document.F1.repassword.value)
{
alert("Check Confirm PWD");
document.F1.repassword.value=""
document.F1.repassword.focus()
return false
}
if(!isNaN(document.F1.phone.value))
{
if(document.F1.phone.value >9999999999 )
{
alert("ye kabhi nhi aayegi")
document.F1.phone.value=""
document.F1.phone.focus()
return false
}
}
else
{
alert("This field must be number")
document.F1.phone.value=""
return false
}
if(!isNaN(document.F1.amount.value))
{
if(document.F1.amount.value < 500)
{
alert("Minimum Balance should be 500 /-")
document.F1.amount.value=""
document.F1.amount.focus()
return false
}
}
else
{
alert("This field must be number")
document.F1.amount.value=""
return false
}
for(var i=0; i<form.elements.length; i++)
{
if(form.elements[i].value == "")
{
alert("Fill out all Fields")
document.F1.username.focus()
return false
}
}
return true
}
import { useState} from "react";
import "./Comp1.css";
const Comp1 =()=>{
const [str] = useState(`Hello`);
const [num] =useState(100);
const [bool] = useState(true);
const [obj]= useState({"key1":"hello_1....","key2":"hello_2...","key3":"hello_3.."});
const[arr] = useState([10,20,30,40,50]);
const[arr1]= useState([`hello_1`,`hello_2`,`hello_3`,`hello_4`,`hello_5`]);
const [arr2] =useState([100,200,300,400,500]);
const [arr3]= useState([`reactJs`,`MongoDb`,`NodeJs`]);
const [arr4] = useState([100,`hello1`,200,`hello2`]);
const [products] = useState([
{"p_id":111,"p_name":"p_one","p_cost":10000},
{"p_id":222,"p_name":"p_two","p_cost":20000},
{"p_id":333,"p_name":"p_three","p_cost":30000},
{"p_id":444,"p_name":"p_four","p_cost":40000},
{"p_id":555,"p_name":"p_five","p_cost":50000}
]);
const [Employee] = useState([
{"e_id":111,"e_name":"e_one","e_sal":10000},
{"e_id":222,"e_name":"e_two","e_sal":20000},
{"e_id":333,"e_name":"e_three","e_sal":30000},
{"e_id":444,"e_name":"e_four","e_sal":40000},
{"e_id":555,"e_name":"e_five","e_sal":50000}
]);
return(
<>
<h1>{str}</h1>
<h1 className="class-one">{num}</h1>
<h1 id="id-one">{JSON.stringify(bool)}</h1>
<h1>{obj.key1}{obj.key2}{obj.key3}</h1>
{arr.map((Element,index)=>{
return(
<h1 key={index}>{Element}....{index}</h1>
)
})
}
{arr1.map((Element,index)=>{
return(
<h2 key={index}>{Element}....{index}</h2>
)
})
}
{arr2.map((Element,index)=>{
return(
<h3 key={index}>{Element}....{index}</h3>
)
})
}
{arr3.map((Element,index)=>{
return(
<h4 key={index}>{Element}....{index}</h4>
)
})
}
{arr4.map((Element,index)=>{
return(
<h5 key={index}>{Element}....{index}</h5>
)
})
}
<table border={1}>
<tr>
<th>p_id</th>
<th>p_name</th>
<th>p_cost</th>
</tr>
{products.map((element,index)=>{
return(
<tr key={index}>
<td>{element.p_id}</td>
<td>{element.p_name}</td>
<td>{element.p_cost}</td>
</tr>
)
})
}
</table>
<table border={1}>
<tr>
<th>e_id</th>
<th>e_name</th>
<th>e_sal</th>
</tr>
{Employee.map((element,index)=>{
return(
<tr key={index}>
<td>{element.e_id}</td>
<td>{element.e_name}</td>
<td>{element.e_sal}</td>
</tr>
)
})
}
</table>
</>
)
}
export default Comp1;
import "./Comp1.css";
const Comp1 =()=>{
const [str] = useState(`Hello`);
const [num] =useState(100);
const [bool] = useState(true);
const [obj]= useState({"key1":"hello_1....","key2":"hello_2...","key3":"hello_3.."});
const[arr] = useState([10,20,30,40,50]);
const[arr1]= useState([`hello_1`,`hello_2`,`hello_3`,`hello_4`,`hello_5`]);
const [arr2] =useState([100,200,300,400,500]);
const [arr3]= useState([`reactJs`,`MongoDb`,`NodeJs`]);
const [arr4] = useState([100,`hello1`,200,`hello2`]);
const [products] = useState([
{"p_id":111,"p_name":"p_one","p_cost":10000},
{"p_id":222,"p_name":"p_two","p_cost":20000},
{"p_id":333,"p_name":"p_three","p_cost":30000},
{"p_id":444,"p_name":"p_four","p_cost":40000},
{"p_id":555,"p_name":"p_five","p_cost":50000}
]);
const [Employee] = useState([
{"e_id":111,"e_name":"e_one","e_sal":10000},
{"e_id":222,"e_name":"e_two","e_sal":20000},
{"e_id":333,"e_name":"e_three","e_sal":30000},
{"e_id":444,"e_name":"e_four","e_sal":40000},
{"e_id":555,"e_name":"e_five","e_sal":50000}
]);
return(
<>
<h1>{str}</h1>
<h1 className="class-one">{num}</h1>
<h1 id="id-one">{JSON.stringify(bool)}</h1>
<h1>{obj.key1}{obj.key2}{obj.key3}</h1>
{arr.map((Element,index)=>{
return(
<h1 key={index}>{Element}....{index}</h1>
)
})
}
{arr1.map((Element,index)=>{
return(
<h2 key={index}>{Element}....{index}</h2>
)
})
}
{arr2.map((Element,index)=>{
return(
<h3 key={index}>{Element}....{index}</h3>
)
})
}
{arr3.map((Element,index)=>{
return(
<h4 key={index}>{Element}....{index}</h4>
)
})
}
{arr4.map((Element,index)=>{
return(
<h5 key={index}>{Element}....{index}</h5>
)
})
}
<table border={1}>
<tr>
<th>p_id</th>
<th>p_name</th>
<th>p_cost</th>
</tr>
{products.map((element,index)=>{
return(
<tr key={index}>
<td>{element.p_id}</td>
<td>{element.p_name}</td>
<td>{element.p_cost}</td>
</tr>
)
})
}
</table>
<table border={1}>
<tr>
<th>e_id</th>
<th>e_name</th>
<th>e_sal</th>
</tr>
{Employee.map((element,index)=>{
return(
<tr key={index}>
<td>{element.e_id}</td>
<td>{element.e_name}</td>
<td>{element.e_sal}</td>
</tr>
)
})
}
</table>
</>
)
}
export default Comp1;
<!DOCTYPE html>
<html>
<head>
<title>React</title>
</head>
<body>
<!-- <script>
let obj ={
key1: 100,
key2: 200,
key3 :300,
};
let {key1,key2,key3}=obj;
document.write(key1,key2,key3);
</script> -->
<script>
let obj3 ={
sub_one :"ReactJs",
sub_two :"NodeJs",
sub_three :"MongoDb",
};
let {sub_one,sub_two,sub_three}=obj;
document.write(sub_one,sub_two,sub_three);
//ReactJs NodeJs MongoDb
</script>
<!-- <script>
let obj = {
key1:{
frontend: "Angular14",
backend:"Dotnet",
database:"SqlServer"
}
}
//let {key1} =obj;
//let {frontend} =key1;
document.write(obj.key1.frontend,obj.key1.backend,obj.key1.database);
</script> -->
<!-- <script>
let obj={
key1:{
sub: "ReactJS"
},
key2:{
sub: "NodeJs"
}
}
let {key1,key2} = obj;
let {sub:sub1}=key1;
let {sub:sub2}=key2;
document.write(sub1,sub2);
//ReactJS NodeJs
</script> -->
<!-- <script>
let obj={
key1:function(){
return
}
};
let {key1} =obj;
document.write(key1());
</script> -->
<!-- <script>
let obj = {
key1:function(){
return{
key1 :"hello"
}
}
};
let {key1} = obj;
let a=key1();
document.write(a.key1);
<!-- </script> -->
<script>
let arr=[{p_id :111,p_name :p_one,p_cost:10000},
{p_id :112,p_name :p_two,p_cost:20000},
{p_id :113,p_name :p_three,p_cost:30000},
{p_id :114,p_name :p_four,p_cost:40000},
{p_id :115,p_name :p_five,p_cost:50000}];
document.write(`
<table border = "1"
align = "center"
cellspacing ="10px"
cellpadding="10px">
<tr>
<th>p_id</th>
<th>p_name</th>
<th>p_cost</th>
</tr>
` );
arr.forEach((element,index)=>{
document.write(`
<tr>
<td>${element.p_id}</td>
<td>${element.p_name}</td>
<td>${element.p_cost}</td>
</tr>
`);
})
document.write(`</table>`);
</script>
<!-- <script>
let arr = [10,20,30,40,50];
let newArr= arr.map((element,index)=>{
return element*10;
})
document.write(newArr);
100,200,300,400,500
</script> -->
<!-- <script>
// let arr = [{key1: "Hello_1"},{key1: "Hello_2"},{key1: "Hello_3"},{key1: "Hello_4"},{key1:"Hello_5"}];
// o/p:=
// ▼(5) [{-}, {-}, {-}, {---}, {---}] @
// ▶0: {key1: 'Hello_1', key2: 'Welcome_1'}
// 1: {key1: 'Hello_2', key2: 'Welcome_2'}
// ► 2: {key1: 'Hello_3', key2: 'Welcome_3'}
// ▶3: {key1: 'Hello_4', key2: 'Welcome_4'}
// ▶4: {key1: 'Hello_5', key2: 'Welcome 5'}
</script> -->
<!-- <script>
let arr =[10000,20000,30000,40000,50000];
let newArr= arr.filter((element,index)=>{
return element>=30000;
})
document.write(newArr)
30000,40000,50000
</script> -->
<!-- <script>
let arr=[{p_id :111,p_name :p_one,e_sal:10000},
{p_id :112,p_name :p_two,e_sal:20000},
{p_id :113,p_name :p_three,e_sal:30000},
{p_id :114,p_name :p_four,e_sal:40000},
{p_id :115,p_name :p_five,e_sal:50000}];
</script> -->
<!-- <script>
let obj ={
key1 : "ReactJs",
key2:{
sub:"nodeJs"
}
}
key3: {
<html>
<head>
<title>React</title>
</head>
<body>
<!-- <script>
let obj ={
key1: 100,
key2: 200,
key3 :300,
};
let {key1,key2,key3}=obj;
document.write(key1,key2,key3);
</script> -->
<script>
let obj3 ={
sub_one :"ReactJs",
sub_two :"NodeJs",
sub_three :"MongoDb",
};
let {sub_one,sub_two,sub_three}=obj;
document.write(sub_one,sub_two,sub_three);
//ReactJs NodeJs MongoDb
</script>
<!-- <script>
let obj = {
key1:{
frontend: "Angular14",
backend:"Dotnet",
database:"SqlServer"
}
}
//let {key1} =obj;
//let {frontend} =key1;
document.write(obj.key1.frontend,obj.key1.backend,obj.key1.database);
</script> -->
<!-- <script>
let obj={
key1:{
sub: "ReactJS"
},
key2:{
sub: "NodeJs"
}
}
let {key1,key2} = obj;
let {sub:sub1}=key1;
let {sub:sub2}=key2;
document.write(sub1,sub2);
//ReactJS NodeJs
</script> -->
<!-- <script>
let obj={
key1:function(){
return
hello }
};
let {key1} =obj;
document.write(key1());
</script> -->
<!-- <script>
let obj = {
key1:function(){
return{
key1 :"hello"
}
}
};
let {key1} = obj;
let a=key1();
document.write(a.key1);
<!-- </script> -->
<script>
let arr=[{p_id :111,p_name :p_one,p_cost:10000},
{p_id :112,p_name :p_two,p_cost:20000},
{p_id :113,p_name :p_three,p_cost:30000},
{p_id :114,p_name :p_four,p_cost:40000},
{p_id :115,p_name :p_five,p_cost:50000}];
document.write(`
<table border = "1"
align = "center"
cellspacing ="10px"
cellpadding="10px">
<tr>
<th>p_id</th>
<th>p_name</th>
<th>p_cost</th>
</tr>
` );
arr.forEach((element,index)=>{
document.write(`
<tr>
<td>${element.p_id}</td>
<td>${element.p_name}</td>
<td>${element.p_cost}</td>
</tr>
`);
})
document.write(`</table>`);
</script>
<!-- <script>
let arr = [10,20,30,40,50];
let newArr= arr.map((element,index)=>{
return element*10;
})
document.write(newArr);
100,200,300,400,500
</script> -->
<!-- <script>
// let arr = [{key1: "Hello_1"},{key1: "Hello_2"},{key1: "Hello_3"},{key1: "Hello_4"},{key1:"Hello_5"}];
// o/p:=
// ▼(5) [{-}, {-}, {-}, {---}, {---}] @
// ▶0: {key1: 'Hello_1', key2: 'Welcome_1'}
// 1: {key1: 'Hello_2', key2: 'Welcome_2'}
// ► 2: {key1: 'Hello_3', key2: 'Welcome_3'}
// ▶3: {key1: 'Hello_4', key2: 'Welcome_4'}
// ▶4: {key1: 'Hello_5', key2: 'Welcome 5'}
</script> -->
<!-- <script>
let arr =[10000,20000,30000,40000,50000];
let newArr= arr.filter((element,index)=>{
return element>=30000;
})
document.write(newArr)
30000,40000,50000
</script> -->
<!-- <script>
let arr=[{p_id :111,p_name :p_one,e_sal:10000},
{p_id :112,p_name :p_two,e_sal:20000},
{p_id :113,p_name :p_three,e_sal:30000},
{p_id :114,p_name :p_four,e_sal:40000},
{p_id :115,p_name :p_five,e_sal:50000}];
</script> -->
<!-- <script>
let obj ={
key1 : "ReactJs",
key2:{
sub:"nodeJs"
}
}
key3: {
sub: "MongoDb"
};
let {key1,key2,key3} = obj;
let {sub:v2} = sub;
let {sub:v3} = sub;
document.write(obj.key1,v1, v2);
//ReactJs nodeJs MongoDb
</script> -->
<script>
let register =()=>{
return {
key1 :"hello1"
}
};
let res = register();
let rs =res.key1;
document.write(rs);
</script>
</body>
</html>
};
let {key1,key2,key3} = obj;
let {sub:v2} = sub;
let {sub:v3} = sub;
document.write(obj.key1,v1, v2);
//ReactJs nodeJs MongoDb
</script> -->
<script>
let register =()=>{
return {
key1 :"hello1"
}
};
let res = register();
let rs =res.key1;
document.write(rs);
</script>
</body>
</html>