0% found this document useful (0 votes)
1K views14 pages

XC ZXC ZXZXC ZX ZCX

Czxccz cz zxc zcxx cx zxc zx zxczxc zxc zxzxcxzczx czx zxc zcx zxc zx czx czx zx czx zxc zc zxc zx z zx czx czx zx c xzcz z zxc

Uploaded by

Deepanshu Joshi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views14 pages

XC ZXC ZXZXC ZX ZCX

Czxccz cz zxc zcxx cx zxc zx zxczxc zxc zxzxcxzczx czx zxc zcx zxc zx czx czx zx czx zxc zc zxc zx z zx czx czx zx c xzcz z zxc

Uploaded by

Deepanshu Joshi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

PENDING LIST :_

UI - ​CONTACTS LISTING || SHOPPING CART ||

VEHICLE LISTING ||

================================================

UI AND UNIX HACKER RANK QUESTIONS WITH ANSWERS


===================================================

TOTAL SETS DISCOVERED TILL NOW:-

UNIX - 4 || EMPOYEE COUNT || STUDENTS RECORDS || EMPTY LINES || COUNT


WORDS

UI - 7 || MY CART || EVENT REGISTRATION || VEHICLE MANAGEMENT ||


CONTACTS MANAGEMENT || CONTACTS LISTINGS || VEHICLE LISTING ||
GRADE SIMPLE TASK

==============================

UNIX - FindDepartmentEmployeeCount

#!/bin/bash
#write your code here
if [ $# -ne 2 ]
then
echo "Pass appropriate number of command line arguments"
elif [ -d $1 ]
then
echo "Input file is not an ordinary file"
elif [ ! -f $1 ]
then
echo "Input file does not exists"
elif [ ! -r $1 ]
then
echo "Input file does not have read permission"
else
grep -i $2 $1 | wc -l
fi

UNIX - CountWords

#!/bin/bash
#write your code here
if [ $# -ne 2 ]
then
echo "Pass appropriate number of command line arguments"
elif [ -d $1 ]
then
echo "Input file is not an ordinary file"
elif [ ! -f $1 ]
then
echo "Input file does not exists"
elif [ ! -r $1 ]
then
echo "Input file does not have read permission"
else
grep -i $2 $1 | wc -l
fi

UNIX - COUNT EMPTY FILES

#!/bin/bash
#write your code here
sum=0
count=0
firstLine=0
found=0

if [ $# -ne 2 ] ; then
echo "Pass appropriate number of command line arguments"
elif [ -d $1 ]; then
echo "Input file is not an ordinary file"
elif [ ! -f $1 ] ; then
echo "Input file does not exist"
elif [ ! -r $1 ]; then
echo "Input file does not have read permission"
else
while read -r line; do
if [ $firstLine -eq 0 ] ; then
firstLine=1
else
while IFS=',' read -r a b c; do
if [ $b = $2 ] ; then
found=1
sum="$(($sum + $c))"
count="$(($count + 1))"
fi
done <<< "$line"
fi
done < "$1"
avg="$(($sum / $count))"
if [ $found -eq 0] ; then
echo "Given designation not found"
else
echo $avg
fi
fi

UNIX - STUDENTS RECORDS

#!/bin/bash
#write your code here
if [ $# -ne 2 ]
then
echo "Pass appropriate number of command line arguments"
elif [ -d $1 ]
then
echo "Input file is not an ordinary file"
elif [ ! -f $1 ]
then
echo "Input file does not exists"
elif [ ! -r $1 ]
then
echo "Input file does not have read permission"
else
grep -i $2 $1 | wc -l
fi

UI - EVENT REGISTRATION /
MANAGEMENT

<html>
<body>
<table id="eventForm" style="border: 1px solid black;width: 80%;text-align:
center;background-color: #fe45e0">
<tr><td colspan="2"><h1>Event Management System</h1><hr></td></tr>
<div id="creationDiv" style="display: block;">
<form action="#" id="createEvent"
onsubmit="event.preventDefault();validateCreation();">
<tr><td colspan="2"><h2>Event Creation Form</h2></td></tr>
<tr>
<td>
<label for="eventId">Event Id</label>
</td>
<td>
<input type="number" id="eventId">
<span id="err1"></span>
</td>
</tr>
<tr>
<td>
<label
for="department">Department</label>
</td>
<td>
<select id="department">
<option
value="Admin">Admin</option>
<option value="HR">HR</option>
<option
value="Finance">Finance</option>
<option
value="Network">Network</option>
</select>
<span id="err2"></span>
</td>
</tr>
<tr>
<td>
<label for="status">Status</label>
</td>
<td>
<select id="status">
<option
value="Open">Open</option>
<option value="In Progress">In
Progress</option>
<option
value="Rejected">Rejected</option>
<option
value="Complete">Complete</option>
</select>
<span id="err3"></span>
</td>
</tr>
<tr>
<td>
<label
for="description">Description</label>
</td>
<td>
<input type="text" id="description">
<span id="err4"></span>
</td>
</tr>
<tr>
<td>
<label for="raisedBy">Raised By</label>
</td>
<td>
<input type="text" id="raisedBy">
<span id="err5"></span>
</td>
</tr>
<tr>
<td>
<label for="contactPhone">Contact
Phone</label>
</td>
<td>
<input type="text" id="contactPhone">
<span id="err6"></span>
</td>
</tr>
<tr>
<td colspan="2"><input id="create" type="submit"
value="Create"><input id="cancel" type="reset" value="Cancel"></td>
</tr>
</form>
</div>
<div id="resultDiv" style="display: none;">
<p>An event is created with id = <span id="eid"></span></p>
<p>Department :<span id="dep"></span></p>
<p>Status :<span id="sta"></span></p>
<p>Raised By :<span id="rai"></span></p>
<button id="close" onclick="show()">Close</button>
</div>
</table>
<script type="text/javascript">

INDEX . JS FILE :_

function validateCreation() {
var err = false;
if(document.getElementById('eventId').value =="") {
document.getElementById('err1').innerText="This field is
required";
err=true;
}
if(document.getElementById('department').value =="") {
document.getElementById('err2').innerText="This field is
required";
err=true;
}
if(document.getElementById('status').value =="") {
document.getElementById('err3').innerText="This field is
required";
err=true;
}
if(document.getElementById('description').value =="") {
document.getElementById('err4').innerText="This field is
required";
err=true;
}
if(document.getElementById('raisedBy').value =="") {
document.getElementById('err5').innerText="This field is
required";
err=true;
}
if(document.getElementById('contactPhone').value =="") {
document.getElementById('err6').innerText="This field is
required";
err=true;
}
if(!err) {
document.getElementById('creationDiv').style.display = "none";
document.getElementById('resultDiv').style.display = "block";
document.getElementById('eid').innerText =
document.getElementById('eventId').value;
document.getElementById('dep').innerText =
document.getElementById('department').value;
document.getElementById('sta').innerText =
document.getElementById('status').value;
document.getElementById('rai').innerText =
document.getElementById('raisedBy').value;
}
}
function show() {
document.getElementById('creationDiv').style.display = "block";
document.getElementById('resultDiv').style.display = "none";
}
</script>
</body>
</html>

UI - CONTACT MANAGEMENT -

​<!DOCTYPE html>
<html>
<head>
<style >
table,tr,th,td
{

border: 1px solid black;


border-collapse: collapse;
}
</style>
<script >

function func()
{
document.getElementById("message").innerHTML ="Customer Contact Created";
}

</script>

</head>
<body>
<h1 style="text-align: center;">ABC Hotels</h1>
<div id="message" onsubmit="func()">
<form name="contactCustomer" id="contactCustomer" >
<table id="contactTable" style="text-align: center;" width="30%" align="center">
<tr>
<th>Label</th>
<th>Control</th>
<th>Validation</th>
</tr>
<tr>
<td>Name</td>
<td><input type="text" name="name" placeholder="Customer Name"
maxlength="50" required= ></td>
<td>Mandatory,Max size=50</td>
</tr>
<tr>
<td>Age</td>
<td><input type="number" placeholder="Customer Age" name="age" min="20"
max="65" required></td>
<td>Mandatory,Value range 20-65</td>
</tr>
<tr>
<td>Email</td>
<td><input type="email" name="email" placeholder="Customer Email"></td>
<td>Mandatory,Valid Email</td>
</tr>
<tr>
<td>Address</td>
<td><input type="text" name="address" placeholder="Customer Address"></td>
<td>Mandatory</td>
</tr>
<tr>
<td>Phone</td>
<td><input type="number" name="phone" placeholder="Customer Phone"></td>
<td>Mandatory</td>
</tr>
<tr>
<td>Send</td>
<td><input type="submit" name="send" value="send" style="background-color:
#FE45EF;" ></td>
<td></td>
</tr>
<tr>
<td>Cancel</td>
<td><input type="reset" name="reset" style="background-color:
#FE45EF;"></td>
<td></td>
</tr>
</table>
</form>

</div>

</body>
</html>

UI - GRADE SIMPLE TASK

You have to first write in a .gradle file :-

apply plugin: 'java'

task(runSimple, dependsOn: 'classes', type: JavaExec) {


main = 'prime.java'
classpath = sourceSets.main.runtimeClasspath
}

defaultTasks 'runSimple'

Now in the folder prime.java you need to write the prime number code like that :​-

class prime
{
public static void main (String[] args)
{
int i =0;
int num =0;

String prime = "";

for (i = 1; i <= 20; i++)


{
int counter=0;
for(num =i; num>=1; num--)
{
if(i%num==0)
{
counter = counter + 1;
}
}
if (counter ==2)
{

primeNumbers = prime + i + " ";


}
}

System.out.println(prime);
}
}

UI - CONTACT LISTING is in working process----

**Attention - ⅗ test cases will pass, js body is blank--


UI - VEHICLE MANAGEMENT
<html>
<head>
<title>Vehicle Registration</title>
<script type="text/javascript" scr="index.js" > </script>
</head>
<body>
<form id="registerVehicle">
<h1>Motor Vehicle Department of Kerala</h1>
<div id="registerDiv">
<h2>Vehicle Registration Form</h2>
</div>
<table style="border:; 1px solid black; width: 80%; text-align: center;
background-color:#EF45E0;" id="vehicle">
<tr>
<td>Full name of Applicant</td>
<td>
<input type="text" required id="fullName" />
<span id="err1"></span>
</td>
</tr>
<tr>
<td>Age</td>
<td>
<input type="number" required id="age" />
<span id="err2"></span>
</td>
</tr>
<tr>
<td>Permanent Address</td>
<td>
<textarea required id="address"></textarea>
<span id="err3"></span>
</td>
</tr>
<tr>
<td>Contact Phone</td>
<td>
<input required type="text" id="phone" />
<span id="err4"></span>
</td>
</tr>
<tr>
<td>Class of vehicle</td>
<td>
<select id="vehClass">
<option value="Motorcycle With out Gear">Motorcycle With out Gear</option>
<option value="Motorcycle With Gear">Motorcycle With Gear</option>
<option value="Motor Car">Motor Car</option>
<option value="Light Motor Vehicle-Transport">Light Motor Vehicle-Transport</option>
</select>
<span id="err5"></span>
</td>
</tr>
<tr>
<td>Engine No</td>
<td>
<input type="number" id="engineNo"/>
<span id="err6"></span>
</td>
</tr>
<tr>
<td colspan="2">
<button type="submit" id="register">Register</button>
<button type="reset" id="cancel">Cancel</button>
</td>
</tr>
</table>
</form>
<div id="resultDiv">Close</div>
</body>
</html>

Index.js :-

Function validateRegister() {
}

===============

2 more ui codes remaining --- will post you at 5:00 pm

You might also like