0% found this document useful (0 votes)
21 views5 pages

Java Programming Solutions Feb 13

The document provides solutions for a Java Proctored Assessment held on February 13, 2025. It includes a program to find the smallest vowel in a given string and a class to manage SIM card details, allowing for the transfer of circles and sorting based on rate per second. Sample inputs and outputs are also provided for both programming tasks.

Uploaded by

hemanthnk04
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)
21 views5 pages

Java Programming Solutions Feb 13

The document provides solutions for a Java Proctored Assessment held on February 13, 2025. It includes a program to find the smallest vowel in a given string and a class to manage SIM card details, allowing for the transfer of circles and sorting based on rate per second. Sample inputs and outputs are also provided for both programming tasks.

Uploaded by

hemanthnk04
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

2/19/25, 8:01 PM java pa 13 feb | Solutions

This site was designed with the .com website builder. Create your website today. Start Now

SOLUTIONS

0
Join Telegram Group Donation Here PAYTM

HOME Previous PA HOME Software Foundation Java Software Foundation -Python Donation OPA May - July Java PA Answer More

Java Proctored Assessment Programming solution 13th February



Question 1.

Write a Program to print smallest vowel in the given line…(Ascii Values)



input:
matrix

output:
a

Solution:

import [Link].*;
import [Link].*;
import [Link].*;
import [Link].*;
public class Main
{
public static void main(String[] args) {
Scanner sc=new Scanner([Link]);
String s=[Link]();
s=[Link]();
int n=[Link]();
int c=0;
char[] ch=[Link]();
for(int i=0;i<n;i++) Contact Us
{
[Link] 1/5
2/19/25, 8:01 PM java pa 13 feb | Solutions

if([Link](i)=='a' || [Link](i)=='e'
This site was designed with the
|| [Link](i)=='i' || [Link](i)=='o'Start
.com website builder. Create your website today.
|| Now

[Link](i)=='u')
{
c++;
}
}
char[] c1=new char[c];
int k=0;
for(int i=0;i<n;i++)
{
if([Link](i)=='a' || [Link](i)=='e' || [Link](i)=='i' || [Link](i)=='o' ||
[Link](i)=='u')
{
c1[k++]=ch[i];
}
}
[Link](c1);
[Link](c1[0]);

}
}

Question 2.

Create a Sim Class with following Attributes
int simId;
String customerName;
double balance;
double ratePerSecond;
String circle;

create a public Class Solution in which take input of 5 object and then take 2 input (circle1,
circle2) for circle of matches as circle1 and choose only those objects which are match
with circle1.

Create a method named as transferCircle() and passed sim object and circle1, circle2 as
parameter and arrange sim object in descending order as per ratePerSecond

Print the output as simId, customerName, circle, ratePerSecond.



Input:

1
raju
130
1.32
mum
[Link] 2/5
2/19/25, 8:01 PM java pa 13 feb | Solutions
mum
This site was designed with the .com website builder. Create your website today. Start Now
2
sachin
120
2.26
ahd
3
ram
200
2.54
kol
4
shubham
640
3.21
ahd
5
kalpesh
150
1.8
ahd
ahd
kol

Output:

4 shubham kol 3.21


2 sachin kol 2.26
5 kalpesh kol 1.8

Solution:

import [Link];
public class SimSolution {
public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
Sim1[] sim = new Sim1[5];
for (int i = 0; i < [Link]; i++) {
int simId = [Link]();
[Link]();
String name = [Link]();
double balance = [Link]();
double ratePersecond = [Link]();
[Link]();
String circle = [Link]();
sim[i] = new Sim1(simId, name, balance,
ratePersecond, circle);
}
[Link] 3/5
2/19/25, 8:01 PM java pa 13 feb | Solutions
}
This site was designed with the .com website builder. Create your website today. Start Now
String circle1 = [Link]();
String circle2 = [Link]();
Sim1[] result = transferCircle(sim, circle1, circle2);
for (int i = 0; i < [Link]; i++) {
[Link](result[i].getSimId() + " " +
result[i].getName() + " " + result[i].getCircle() + " "
+ result[i].getRatePersecond());
}
[Link]();
}
public static Sim1[] transferCircle(Sim1[] sim, String
circle1, String circle2) {
Sim1[] temp;
int j = 0;
for (int i = 0; i < [Link]; i++) {
if (sim[i].getCircle().equals(circle1)) {
j++;
}
}
temp = new Sim1[j];
j = 0;
for (int i = 0; i < [Link]; i++) {
if (sim[i].getCircle().equals(circle1)) {
temp[j] = sim[i];
temp[j++].setCircle(circle2);
}
}
for (int i = 0; i < j - 1; i++) {
for (int k = 0; k < j - 1; k++) {
if (temp[k].getRatePersecond() < temp[k +
1].getRatePersecond()) {
Sim1 a = temp[k];
temp[k] = temp[k + 1];
temp[k + 1] = a;
}
}
}
return temp;
}
}
class Sim1 {
private int simId;
private String name;
private double balance;
private double ratePersecond;
private String circle;
public Sim1(int simId String name double balance double
[Link] 4/5
2/19/25, 8:01 PM java pa 13 feb | Solutions
public Sim1(int simId, String name, double balance, double
This site was designed with the .com website builder. Create your website today. Start Now
ratePersecond, String circle) {
[Link] = simId;
[Link] = name;
[Link] = balance;
[Link] = ratePersecond;
[Link] = circle;
}
public int getSimId() {
return simId;
}
public void setSimId(int simId) {
[Link] = simId;
}
public String getName() {
return name;
}
public void setName(String name) {
[Link] = name;
}
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
[Link] = balance;
}
public double getRatePersecond() {
return ratePersecond;
}
public void setRatePersecond(double ratePersecond) {
[Link] = ratePersecond;
}
public String getCircle() {
return circle;
}
public void setCircle(String circle) {
[Link] = circle;
}
}

©2018 by The real one. Proudly created with [Link]

[Link] 5/5

You might also like